diff --git a/collects/scribble/base-render.ss b/collects/scribble/base-render.ss index 20e797c3..995509a5 100644 --- a/collects/scribble/base-render.ss +++ b/collects/scribble/base-render.ss @@ -1,9 +1,9 @@ -(module base-render mzscheme +(module base-render scheme/base (require "struct.ss" - (lib "class.ss") - (lib "serialize.ss") - (lib "file.ss")) + mzlib/class + mzlib/serialize + scheme/file) (provide render%) @@ -290,9 +290,9 @@ (map (lambda (d fn) (printf " [Output to ~a]\n" fn) (with-output-to-file fn + #:exists 'truncate/replace (lambda () - (render-one d ri fn)) - 'truncate/replace)) + (render-one d ri fn)))) ds fns)) diff --git a/collects/scribble/basic.ss b/collects/scribble/basic.ss index 0ec3c1b9..b7664504 100644 --- a/collects/scribble/basic.ss +++ b/collects/scribble/basic.ss @@ -1,12 +1,13 @@ -(module basic (lib "lang.ss" "big") +(module basic scheme/base (require "decode.ss" "struct.ss" "config.ss" - (lib "list.ss") - (lib "class.ss") - (lib "main-collects.ss" "setup") - (lib "modresolve.ss" "syntax")) + mzlib/list + mzlib/class + setup/main-collects + syntax/modresolve + (for-syntax scheme/base)) (provide title section @@ -26,17 +27,22 @@ p (module-path-prefix->string p)))) + (define (convert-tag tag content) + (if (list? tag) + (apply append (map (lambda (t) (convert-tag t content)) tag)) + `((part ,(or tag (gen-tag content)))))) + (define (title #:tag [tag #f] #:tag-prefix [prefix #f] #:style [style #f] . str) (let ([content (decode-content str)]) (make-title-decl (prefix->string prefix) - `((part ,(or tag (gen-tag content)))) + (convert-tag tag content) style content))) (define (section #:tag [tag #f] #:tag-prefix [prefix #f] #:style [style #f] . str) (let ([content (decode-content str)]) (make-part-start 0 (prefix->string prefix) - `((part ,(or tag (gen-tag content)))) + (convert-tag tag content) style content))) @@ -44,7 +50,7 @@ (let ([content (decode-content str)]) (make-part-start 1 (prefix->string prefix) - `((part ,(or tag (gen-tag content)))) + (convert-tag tag content) #f content))) @@ -52,7 +58,7 @@ (let ([content (decode-content str)]) (make-part-start 2 (prefix->string prefix) - `((part ,(or tag (gen-tag content)))) + (convert-tag tag content) #f content))) @@ -60,12 +66,13 @@ (let ([content (decode-content str)]) (make-paragraph (list (make-element 'bold content))))) - (define-syntax include-section - (syntax-rules () + (define-syntax (include-section stx) + (syntax-case stx () [(_ mod) - (begin - (require (only mod doc)) - doc)])) + (with-syntax ([mod (syntax-local-introduce #'mod)]) + #'(begin + (require (only-in mod doc)) + doc))])) ;; ---------------------------------------- @@ -201,9 +208,9 @@ (part-collected-info sec ri)) ri)) (lambda (k v) - (if (and (pair? k) - (eq? 'index-entry (car k))) - (set! l (cons (cons (cadr k) v) l))))) + (when (and (pair? k) + (eq? 'index-entry (car k))) + (set! l (cons (cons (cadr k) v) l))))) (let ([l (sort l (lambda (a b) diff --git a/collects/scribble/doclang.ss b/collects/scribble/doclang.ss index 61df31a4..f071b79a 100644 --- a/collects/scribble/doclang.ss +++ b/collects/scribble/doclang.ss @@ -1,19 +1,19 @@ -(module doclang (lib "lang.ss" "big") +(module doclang scheme/base (require "struct.ss" "decode.ss" - (lib "kw.ss")) - (require-for-syntax (lib "kerncase.ss" "syntax")) + (for-syntax scheme/base + syntax/kerncase)) - (provide (all-from-except (lib "lang.ss" "big") #%module-begin) - (rename *module-begin #%module-begin)) + (provide (except-out (all-from-out scheme/base) #%module-begin) + (rename-out [*module-begin #%module-begin])) ;; Module wrapper ---------------------------------------- (define-syntax (*module-begin stx) (syntax-case stx () [(_ id exprs . body) - #'(#%plain-module-begin + #'(#%module-begin (doc-begin id exprs . body))])) (define-syntax (doc-begin stx) @@ -40,21 +40,17 @@ (let ([expanded (local-expand #'body1 'module (append - (kernel-form-identifier-list #'here) + (kernel-form-identifier-list) (syntax->list #'(provide - require - require-for-syntax - require-for-label))))]) + require))))]) (syntax-case expanded (begin) [(begin body1 ...) #`(doc-begin m-id exprs body1 ... . body)] [(id . rest) (and (identifier? #'id) - (ormap (lambda (kw) (module-identifier=? #'id kw)) + (ormap (lambda (kw) (free-identifier=? #'id kw)) (syntax->list #'(require provide - require-for-syntax - require-for-label define-values define-syntaxes define-for-syntaxes)))) diff --git a/collects/scribble/docreader.ss b/collects/scribble/docreader.ss index c25f05bd..b9e6ea8b 100644 --- a/collects/scribble/docreader.ss +++ b/collects/scribble/docreader.ss @@ -1,15 +1,14 @@ -(module docreader mzscheme - (require (prefix scribble: "reader.ss") - (lib "kw.ss")) +(module docreader scheme/base + (require (prefix-in scribble: "reader.ss")) - (provide (rename *read read) - (rename *read-syntax read-syntax)) + (provide (rename-out [*read read]) + (rename-out [*read-syntax read-syntax])) - (define/kw (*read #:optional [inp (current-input-port)]) + (define (*read [inp (current-input-port)]) (wrap inp (scribble:read-inside inp))) - (define/kw (*read-syntax #:optional src [port (current-input-port)]) + (define (*read-syntax [src #f] [port (current-input-port)]) (wrap port (scribble:read-inside-syntax src port))) (define (wrap port body) @@ -19,7 +18,7 @@ (string->symbol (path->string (path-replace-suffix name #"")))) 'page)] [id 'doc]) - `(module ,name (lib "doclang.ss" "scribble") + `(module ,name scribble/doclang (#%module-begin ,id () . ,body))))) diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss index c041dd1e..898f2b02 100644 --- a/collects/scribble/eval.ss +++ b/collects/scribble/eval.ss @@ -1,12 +1,12 @@ -(module eval (lib "lang.ss" "big") +(module eval scheme/base (require "manual.ss" "struct.ss" "scheme.ss" "decode.ss" - (lib "class.ss") - (lib "file.ss") - (lib "string.ss")) + scheme/file + mzlib/string + (for-syntax scheme/base)) (provide interaction interaction-eval @@ -33,6 +33,17 @@ (define maxlen 60) + (namespace-require 'scheme/base) + + (define (literal-string style s) + (let ([m (regexp-match #rx"^(.*)( +)(.*)$" s)]) + (if m + (make-element #f + (list (literal-string style (cadr m)) + (hspace (string-length (caddr m))) + (literal-string style (cadddr m)))) + (make-element style (list s))))) + (define (format-output str style) (if (string=? "" str) null @@ -48,14 +59,14 @@ (make-paragraph (list (hspace 2) - (span-class style (car s)))) + (literal-string style (car s)))) (make-table #f (map (lambda (s) (list (make-flow (list (make-paragraph (list (hspace 2) - (span-class style s))))))) + (literal-string style s))))))) s)))))))))) (define (interleave title expr-paras val-list+outputs) @@ -145,11 +156,12 @@ => (lambda (v) v)] [(string? v) (install ht v (string-copy v))] [(bytes? v) (install ht v (bytes-copy v))] - [(pair? v) (let ([p (cons #f #f)]) - (hash-table-put! ht v p) - (set-car! p (copy-value (car v) ht)) - (set-cdr! p (copy-value (cdr v) ht)) - p)] + [(pair? v) (cons (copy-value (car v) ht) + (copy-value (cdr v) ht))] + [(mpair? v) (let ([p (mcons #f #f)]) + (set-mcar! p (copy-value (mcar v) ht)) + (set-mcdr! p (copy-value (mcdr v) ht)) + p)] [(vector? v) (let ([v2 (make-vector (vector-length v))]) (hash-table-put! ht v v2) (let loop ([i (vector-length v2)]) @@ -169,12 +181,12 @@ [((code:comment . _) . rest) (strip-comments #'rest)] [(a . b) - (datum->syntax-object stx - (cons (strip-comments #'a) - (strip-comments #'b)) - stx - stx - stx)] + (datum->syntax stx + (cons (strip-comments #'a) + (strip-comments #'b)) + stx + stx + stx)] [code:blank #'(void)] [else stx])) @@ -187,7 +199,7 @@ (let ([s (strip-comments s)]) (syntax-case s (module) [(module . _rest) - (syntax-object->datum s)] + (syntax->datum s)] [_else s])))) list))) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 6d100343..54404576 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -1,13 +1,14 @@ -(module html-render mzscheme +(module html-render scheme/base (require "struct.ss" - (lib "class.ss") - (lib "file.ss") - (lib "list.ss") - (lib "runtime-path.ss") - (lib "main-doc.ss" "setup") - (lib "main-collects.ss" "setup") - (prefix xml: (lib "xml.ss" "xml"))) + scheme/class + scheme/file + mzlib/runtime-path + setup/main-doc + setup/main-collects + mzlib/list + (prefix-in xml: xml/xml) + (for-syntax scheme/base)) (provide render-mixin render-multi-mixin) @@ -210,7 +211,7 @@ (lambda (para) (let loop ([c (paragraph-content para)]) (cond - [(empty? c) null] + [(null? c) null] [else (let ([a (car c)]) (cond [(toc-target-element? a) @@ -280,7 +281,8 @@ (href "scribble.css") (title "default")))) (body ,@(render-toc-view d ri) - (div ((class "main")) ,@(render-part d ri))))]) + (div ((class "maincolumn")) + (div ((class "main")) ,@(render-part d ri)))))]) (install-file scribble-css) (xml:write-xml/content (xml:xexpr->xml xpr))))) @@ -577,9 +579,9 @@ (parameterize ([current-subdirectory (file-name-from-path fn)]) (let ([fn (build-path fn "index.html")]) (with-output-to-file fn + #:exists 'truncate/replace (lambda () - (render-one d ri fn)) - 'truncate/replace)))) + (render-one d ri fn)))))) ds fns)) @@ -718,9 +720,9 @@ filename)]) (parameterize ([on-separate-page #t]) (with-output-to-file full-path + #:exists 'truncate/replace (lambda () - (render-one-part d ri full-path number)) - 'truncate/replace) + (render-one-part d ri full-path number))) null))] [else (let ([sep? (on-separate-page)]) diff --git a/collects/scribble/info.ss b/collects/scribble/info.ss index c711e748..e796d2cb 100644 --- a/collects/scribble/info.ss +++ b/collects/scribble/info.ss @@ -1,4 +1,4 @@ -(module info (lib "infotab.ss" "setup") +(module info setup/infotab (define name "Scribble") (define blurb '("MzScheme extensions for writing text.")) (define mzscheme-launcher-names '("scribble")) diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index db64784a..e8a8ddd3 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -1,7 +1,7 @@ -(module latex-render mzscheme +(module latex-render scheme/base (require "struct.ss" - (lib "class.ss")) + mzlib/class) (provide render-mixin) (define current-table-mode (make-parameter #f)) diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index c2ffc029..39dc7360 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -1,20 +1,20 @@ -(module manual (lib "lang.ss" "big") +(module manual scheme/base (require "decode.ss" "struct.ss" "scheme.ss" "config.ss" "basic.ss" - (lib "string.ss") - (lib "list.ss") - (lib "class.ss") - (lib "stxparam.ss") - (lib "serialize.ss")) - (require-for-syntax (lib "stxparam.ss")) - (require-for-label (lib "lang.ss" "big") - (lib "class.ss")) + mzlib/string + scheme/class + scheme/stxparam + mzlib/serialize + (for-syntax scheme/base) + (for-label scheme/base + scheme/class)) - (provide (all-from "basic.ss")) + (provide (all-from-out "basic.ss") + unsyntax) (provide PLaneT) (define PLaneT "PLaneT") @@ -42,9 +42,9 @@ (define-syntax (schememod stx) (syntax-case stx () [(_ lang rest ...) - (with-syntax ([modtag (datum->syntax-object + (with-syntax ([modtag (datum->syntax #'here - `(unsyntax (schemefont ,(format "#module ~a" (syntax-e #'lang)))) + `(unsyntax (schemefont ,(format "#lang ~a" (syntax-e #'lang)))) #'lang)]) #'(schemeblock modtag rest ...))])) @@ -61,7 +61,7 @@ (boolean? sv) (and (pair? sv) (identifier? (car sv)) - (module-identifier=? #'cons (car sv)))) + (free-identifier=? #'cons (car sv)))) ;; We know that the context is irrelvant #'s ;; Context may be relevant: @@ -124,11 +124,26 @@ [else (format "~s" s)])]) (index* (list k) (list e) e))) - (provide schemeblock SCHEMEBLOCK - schemeblock0 SCHEMEBLOCK0 + (define-syntax define-/form + (syntax-rules () + [(_ id base) + (define-syntax (id stx) + (syntax-case stx () + [(_ a) + (with-syntax ([ellipses (datum->syntax #'a + '(... ...))]) + #'(let ([ellipses #f]) + (base a)))]))])) + + (define-/form schemeblock0/form schemeblock0) + (define-/form schemeblock/form schemeblock) + (define-/form scheme/form scheme) + + (provide schemeblock SCHEMEBLOCK schemeblock/form + schemeblock0 SCHEMEBLOCK0 schemeblock0/form schemeinput schememod - scheme schemeresult schemeid schememodname + scheme scheme/form schemeresult schemeid schememodname indexed-scheme litchar verbatim) @@ -136,7 +151,7 @@ (provide onscreen menuitem defterm schemefont schemevalfont schemeresultfont schemeidfont schemeparenfont schemekeywordfont schememetafont schememodfont - file exec envvar Flag DFlag + filepath exec envvar Flag DFlag indexed-file indexed-envvar link procedure idefterm) @@ -166,10 +181,10 @@ (make-element "schememod" (decode-content str))) (define (schemekeywordfont . str) (make-element "schemekeyword" (decode-content str))) - (define (file . str) + (define (filepath . str) (make-element 'tt (append (list "\"") (decode-content str) (list "\"")))) (define (indexed-file . str) - (let* ([f (apply file str)] + (let* ([f (apply filepath str)] [s (element->string f)]) (index* (list (substring s 1 (sub1 (string-length s)))) (list f) f))) (define (exec . str) @@ -202,7 +217,7 @@ ;; ---------------------------------------- - (provide method xmethod (rename method ::)) + (provide method xmethod (rename-out [method ::])) (define-syntax method (syntax-rules () @@ -234,8 +249,10 @@ (provide margin-note) (define (margin-note . c) - (make-styled-paragraph (list (make-element "refcontent" - c)) + (make-styled-paragraph (list (make-element "refcolumn" + (list + (make-element "refcontent" + c)))) "refpara")) ;; ---------------------------------------- @@ -280,6 +297,7 @@ defidform specform specform/subs specsubform specsubform/subs specspecsubform specspecsubform/subs specsubform/inline + defsubform schemegrammar schemegrammar* var svar void-const undefined-const) @@ -305,10 +323,10 @@ (syntax-position s) (syntax-span s)))]) #'(let ([s (quote-syntax id)]) - (datum->syntax-object s - (syntax-e s) - 'loc - s)))])) + (datum->syntax s + (syntax-e s) + 'loc + s)))])) (define void-const (schemeresultfont "#")) @@ -365,14 +383,14 @@ (lambda () (list desc ...)))])) (define-syntax defstruct (syntax-rules () - [(_ name fields #:immutable #:inspector #f desc ...) - (**defstruct name fields #t #t desc ...)] - [(_ name fields #:immutable desc ...) - (**defstruct name fields #t #f desc ...)] - [(_ name fields #:inspector #f desc ...) + [(_ name fields #:mutable #:inspector #f desc ...) (**defstruct name fields #f #t desc ...)] + [(_ name fields #:mutable desc ...) + (**defstruct name fields #f #f desc ...)] + [(_ name fields #:inspector #f desc ...) + (**defstruct name fields #t #t desc ...)] [(_ name fields desc ...) - (**defstruct name fields #f #f desc ...)])) + (**defstruct name fields #t #f desc ...)])) (define-syntax **defstruct (syntax-rules () [(_ name ([field field-contract] ...) immutable? transparent? desc ...) @@ -385,23 +403,23 @@ (with-syntax ([new-spec (syntax-case #'spec () [(name . rest) - (datum->syntax-object #'spec - (cons - (datum->syntax-object #'here - '(unsyntax x) - #'name) - #'rest) - #'spec)])] + (datum->syntax #'spec + (cons + (datum->syntax #'here + '(unsyntax x) + #'name) + #'rest) + #'spec)])] [spec-id (syntax-case #'spec () [(name . rest) #'name])]) #'(*defforms (quote-syntax/loc spec-id) '(lit ...) '(spec spec1 ...) - (list (lambda (x) (schemeblock0 new-spec)) - (lambda (ignored) (schemeblock0 spec1)) ...) + (list (lambda (x) (schemeblock0/form new-spec)) + (lambda (ignored) (schemeblock0/form spec1)) ...) '((non-term-id non-term-form ...) ...) (list (list (lambda () (scheme non-term-id)) - (lambda () (schemeblock0 non-term-form)) + (lambda () (schemeblock0/form non-term-form)) ...) ...) (lambda () (list desc ...))))] @@ -423,7 +441,7 @@ (syntax-case stx () [(_ spec desc ...) #'(*defforms #f null - '(spec) (list (lambda (ignored) (schemeblock0 spec))) + '(spec) (list (lambda (ignored) (schemeblock0/form spec))) null null (lambda () (list desc ...)))])) (define-syntax (defidform stx) @@ -435,19 +453,22 @@ null null (lambda () (list desc ...)))])) + (define-syntax (defsubform stx) + (syntax-case stx () + [(_ . rest) #'(into-blockquote (defform . rest))])) (define-syntax specsubform (syntax-rules () [(_ #:literals (lit ...) spec desc ...) - (*specsubform 'spec #f '(lit ...) (lambda () (schemeblock0 spec)) null null (lambda () (list desc ...)))] + (*specsubform 'spec #f '(lit ...) (lambda () (schemeblock0/form spec)) null null (lambda () (list desc ...)))] [(_ spec desc ...) - (*specsubform 'spec #f null (lambda () (schemeblock0 spec)) null null (lambda () (list desc ...)))])) + (*specsubform 'spec #f null (lambda () (schemeblock0/form spec)) null null (lambda () (list desc ...)))])) (define-syntax specsubform/subs (syntax-rules () [(_ #:literals (lit ...) spec ([non-term-id non-term-form ...] ...) desc ...) - (*specsubform 'spec #f '(lit ...) (lambda () (schemeblock0 spec)) + (*specsubform 'spec #f '(lit ...) (lambda () (schemeblock0/form spec)) '((non-term-id non-term-form ...) ...) (list (list (lambda () (scheme non-term-id)) - (lambda () (schemeblock0 non-term-form)) + (lambda () (schemeblock0/form non-term-form)) ...) ...) (lambda () (list desc ...)))] @@ -464,18 +485,18 @@ (define-syntax specform (syntax-rules () [(_ #:literals (lit ...) spec desc ...) - (*specsubform 'spec #t '(lit ...) (lambda () (schemeblock0 spec)) null null (lambda () (list desc ...)))] + (*specsubform 'spec #t '(lit ...) (lambda () (schemeblock0/form spec)) null null (lambda () (list desc ...)))] [(_ spec desc ...) - (*specsubform 'spec #t null (lambda () (schemeblock0 spec)) null null (lambda () (list desc ...)))])) + (*specsubform 'spec #t null (lambda () (schemeblock0/form spec)) null null (lambda () (list desc ...)))])) (define-syntax specform/subs (syntax-rules () [(_ #:literals (lit ...) spec ([non-term-id non-term-form ...] ...) desc ...) (*specsubform 'spec #t '(lit ...) - (lambda () (schemeblock0 spec)) + (lambda () (schemeblock0/form spec)) '((non-term-id non-term-form ...) ...) (list (list (lambda () (scheme non-term-id)) - (lambda () (schemeblock0 non-term-form)) + (lambda () (schemeblock0/form non-term-form)) ...) ...) (lambda () (list desc ...)))] @@ -501,7 +522,7 @@ (syntax-rules () [(_ #:literals (lit ...) id clause ...) (*schemegrammar '(lit ...) '(id clause ...) - (lambda () (list (list (scheme id) (schemeblock0 clause) ...))))] + (lambda () (list (list (scheme id) (schemeblock0/form clause) ...))))] [(_ id clause ...) (schemegrammar #:literals () id clause ...)])) (define-syntax schemegrammar* (syntax-rules () @@ -509,7 +530,7 @@ '(id ... clause ... ...) (lambda () (list - (list (scheme id) (schemeblock0 clause) ...) ...)))] + (list (scheme id) (schemeblock0/form clause) ...) ...)))] [(_ [id clause ...] ...) (schemegrammar #:literals () [id clause ...] ...)])) (define-syntax var (syntax-rules () @@ -518,6 +539,13 @@ (syntax-rules () [(_ id) (*var 'id)])) + (define (into-blockquote s) + (cond + [(splice? s) + (make-blockquote "leftindent" (flow-paragraphs (decode-flow (splice-run s))))] + [else + (make-blockquote "leftindent" (list s))])) + (define (make-table-if-necessary style content) (if (= 1 (length content)) (let ([paras (apply append (map flow-paragraphs (car content)))]) @@ -879,9 +907,9 @@ (map symbol->string (car wrappers)))] [tag (register-scheme-definition - (datum->syntax-object stx-id - (string->symbol - name)) + (datum->syntax stx-id + (string->symbol + name)) #t)]) (if tag (inner-make-target-element @@ -937,9 +965,9 @@ values (map (lambda (f) (if (and (pair? (car f)) - (memq '#:immutable (car f))) - #f - (list 'set- name '- (field-name f) '!))) + (memq '#:mutable (car f))) + (list 'set- name '- (field-name f) '!) + #f)) fields)))))))]) (if (pair? name) (to-element (list just-name @@ -1010,11 +1038,11 @@ e))))) (loop (cdr fields)))))) (cond - [(and immutable? transparent?) + [(and (not immutable?) transparent?) (list (list (to-flow spacer) (to-flow spacer) - (to-flow (to-element '#:immutable)) + (to-flow (to-element '#:mutable)) 'cont 'cont) (list (to-flow spacer) @@ -1027,13 +1055,13 @@ (schemeparenfont ")")))) 'cont 'cont))] - [immutable? + [(not immutable?) (list (list (to-flow spacer) (to-flow spacer) (to-flow (make-element #f - (list (to-element '#:immutable) + (list (to-element '#:mutable) (schemeparenfont ")")))) 'cont 'cont))] @@ -1117,7 +1145,7 @@ (loop (cdr form)))] [else null]))) forms))] - [current-meta-list '(... ...+)]) + [current-meta-list '(... ...+)]) (make-splice (cons (make-table @@ -1267,7 +1295,7 @@ (provide commandline) (define (commandline . s) (make-paragraph (list (hspace 2) (apply tt s)))) - + (define (elemtag t . body) (make-target-element #f (decode-content body) `(elem ,t))) (define (elemref t . body) @@ -1329,21 +1357,21 @@ "[...]" #; (make-bibliography-element - #f - (list "[...]") - key - (list (string-append - (content->string (list author)) - ", " - (content->string (list title)))) - (list (make-element #f (list author - ", " - title - ", " - date - ". " - location - "."))))) + #f + (list "[...]") + key + (list (string-append + (content->string (list author)) + ", " + (content->string (list title)))) + (list (make-element #f (list author + ", " + title + ", " + date + ". " + location + "."))))) ;; ---------------------------------------- @@ -1444,7 +1472,8 @@ (list (symbol->string (syntax-e (decl-name decl)))) tag))) (and (decl-super decl) - (not (module-label-identifier=? #'object% (decl-super decl))) + (not (free-label-identifier=? (quote-syntax object%) + (decl-super decl))) (register-scheme-definition (decl-super decl))) (map register-scheme-definition (decl-intfs decl)) (map (lambda (m) @@ -1545,17 +1574,17 @@ (syntax-rules () [(_ *include-class name super (intf ...) body ...) (*include-class - (syntax-parameterize ([current-class (quote-syntax name)]) - (make-decl (quote-syntax/loc name) - (quote-syntax/loc super) - (list (quote-syntax/loc intf) ...) - (lambda (whole-page?) - (list - (*class-doc (quote-syntax/loc name) - (quote-syntax super) - (list (quote-syntax intf) ...) - whole-page?))) - (list body ...))))])) + (syntax-parameterize ([current-class (quote-syntax name)]) + (make-decl (quote-syntax/loc name) + (quote-syntax/loc super) + (list (quote-syntax/loc intf) ...) + (lambda (whole-page?) + (list + (*class-doc (quote-syntax/loc name) + (quote-syntax super) + (list (quote-syntax intf) ...) + whole-page?))) + (list body ...))))])) (define-syntax defclass (syntax-rules () @@ -1598,15 +1627,15 @@ [(_ mode ((arg ...) ...) desc ...) (let ([n (syntax-parameter-value #'current-class)]) (with-syntax ([name n] - [result (datum->syntax-object #f - (list - (datum->syntax-object #'is-a?/c - 'is-a?/c - (list 'src 1 1 2 1)) - (datum->syntax-object n - (syntax-e n) - (list 'src 1 3 4 1))) - (list 'src 1 0 1 5))] + [result (datum->syntax #f + (list + (datum->syntax #'is-a?/c + 'is-a?/c + (list 'src 1 1 2 1)) + (datum->syntax n + (syntax-e n) + (list 'src 1 3 4 1))) + (list 'src 1 0 1 5))] [(((kw ...) ...) ...) (map (lambda (ids) (map (lambda (arg) (if (and (pair? (syntax-e arg)) diff --git a/collects/scribble/run.ss b/collects/scribble/run.ss index c7871114..1001fe14 100644 --- a/collects/scribble/run.ss +++ b/collects/scribble/run.ss @@ -91,6 +91,6 @@ (when (current-info-output-file) (let ([s (send renderer serialize-info r-info)]) (with-output-to-file (current-info-output-file) + #:exists 'truncate/replace (lambda () - (write s)) - 'truncate/replace)))))))))) + (write s)))))))))))) diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index 59cb5bd2..cfebd122 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -1,11 +1,12 @@ -(module scheme (lib "lang.ss" "big") +(module scheme scheme/base (require "struct.ss" "basic.ss" - (lib "class.ss") - (lib "for.ss") - (lib "main-collects.ss" "setup") - (lib "modresolve.ss" "syntax")) - + mzlib/class + mzlib/for + setup/main-collects + syntax/modresolve + (for-syntax scheme/base)) + (provide define-code to-element to-element/no-color @@ -19,8 +20,8 @@ current-variable-list current-meta-list - (struct shaped-parens (val shape)) - (struct just-context (val ctx))) + (struct-out shaped-parens) + (struct-out just-context)) (define no-color "schemeplain") (define reader-color "schemereader") @@ -219,29 +220,29 @@ [else (let ([p2 (syntax-position (car l))]) (if (and p2 (p2 . > . (syntax-position a))) - (datum->syntax-object c - (append - (reverse prev) - (list - (datum->syntax-object - a - (let ([val? (positive? quote-depth)]) - (make-sized-element - (if val? value-color #f) - (list - (make-element (if val? value-color paren-color) '(". ")) - (typeset a #f "" "" "" (not val?)) - (make-element (if val? value-color paren-color) '(" ."))) - (+ (syntax-span a) 4))) - (list (syntax-source a) - (syntax-line a) - (- (syntax-column a) 2) - (- (syntax-position a) 2) - (+ (syntax-span a) 4)) - a)) - l) - c - c) + (datum->syntax c + (append + (reverse prev) + (list + (datum->syntax + a + (let ([val? (positive? quote-depth)]) + (make-sized-element + (if val? value-color #f) + (list + (make-element (if val? value-color paren-color) '(". ")) + (typeset a #f "" "" "" (not val?)) + (make-element (if val? value-color paren-color) '(" ."))) + (+ (syntax-span a) 4))) + (list (syntax-source a) + (syntax-line a) + (- (syntax-column a) 2) + (- (syntax-position a) 2) + (+ (syntax-span a) 4)) + a)) + l) + c + c) (loop (cdr l) (cons (car l) prev))))])))))) (define (no-fancy-chars s) @@ -257,7 +258,7 @@ (eq? (syntax-e (car (syntax-e c))) 'code:comment)) (advance c init-line!) (out "; " comment-color) - (let ([v (syntax-object->datum (cadr (syntax->list c)))]) + (let ([v (syntax->datum (cadr (syntax->list c)))]) (if (paragraph? v) (map (lambda (v) (let ([v (no-fancy-chars v)]) @@ -289,7 +290,7 @@ (let ([l (syntax->list c)] [h? highlight?]) (unless (and l (= 2 (length l))) - (error "bad code:redex: ~e" (syntax-object->datum c))) + (error "bad code:redex: ~e" (syntax->datum c))) (advance c init-line!) (set! src-col (syntax-column (cadr l))) (hash-table-put! next-col-map src-col dest-col) @@ -304,7 +305,7 @@ (set! src-col (+ src-col 1)) (hash-table-put! next-col-map src-col dest-col) ((loop init-line! quote-depth) - (datum->syntax-object #'here 'quote (car (syntax-e c)))) + (datum->syntax #'here 'quote (car (syntax-e c)))) (for-each (loop init-line! (add1 quote-depth)) (cdr (syntax->list c))) (out ")" (if (positive? quote-depth) value-color paren-color)) @@ -460,7 +461,7 @@ [(elem color len) (make-sized-element (and color? color) (list elem) len)]) color? 0)))) - + (define (to-element c) (typeset c #f "" "" "" #t)) @@ -482,7 +483,7 @@ (cond [(syntax? v) (let ([mk `(,#'d->s - (quote-syntax ,(datum->syntax-object v 'defcode)) + (quote-syntax ,(datum->syntax v 'defcode)) ,(syntax-case v (uncode) [(uncode e) #'e] [else (stx->loc-s-expr (syntax-e v))]) @@ -504,7 +505,7 @@ [(null? v) 'null] [else `(quote ,v)])) (define (cvt s) - (datum->syntax-object #'here (stx->loc-s-expr s) #f)) + (datum->syntax #'here (stx->loc-s-expr s) #f)) (syntax-case stx () [(_ expr) #`(typeset-code #,(cvt #'expr))] [(_ expr (... ...)) @@ -512,13 +513,13 @@ [(_ code typeset-code uncode d->s) #'(define-code code typeset-code uncode d->s syntax-property)] [(_ code typeset-code uncode) - #'(define-code code typeset-code uncode datum->syntax-object syntax-property)] + #'(define-code code typeset-code uncode datum->syntax syntax-property)] [(_ code typeset-code) #'(define-code code typeset-code unsyntax)])) (define (register-scheme stx [warn-if-no-label? #f]) (unless (identifier? stx) - (error 'register-scheme-definition "not an identifier: ~e" (syntax-object->datum stx))) + (error 'register-scheme-definition "not an identifier: ~e" (syntax->datum stx))) (let ([b (identifier-label-binding stx)]) (if (or (not b) (eq? b 'lexical)) @@ -535,10 +536,10 @@ (format ":NOLABEL:~a" (syntax-e stx))) #f) (format ":~a:~a" - (if (module-path-index? (car b)) - (let ([p (resolve-module-path-index (car b) #f)]) - (path->main-collects-relative p)) - (car b)) + (let ([p (resolve-module-path-index (car b) #f)]) + (if (path? p) + (path->main-collects-relative p) + p)) (cadr b))))) (define (register-scheme/invent stx warn-if-no-label?) @@ -589,11 +590,11 @@ (shaped-parens-shape v))] [(just-context? v) (let ([s (syntax-ize (just-context-val v) col)]) - (datum->syntax-object (just-context-ctx v) - (syntax-e s) - s - s - (just-context-ctx v)))] + (datum->syntax (just-context-ctx v) + (syntax-e s) + s + s + (just-context-ctx v)))] [(and (list? v) (pair? v) (memq (let ([s (car v)]) @@ -602,11 +603,11 @@ s)) '(quote unquote unquote-splicing))) (let ([c (syntax-ize (cadr v) (+ col 1))]) - (datum->syntax-object #f - (list (syntax-ize (car v) col) - c) - (list #f 1 col (+ 1 col) - (+ 1 (syntax-span c)))))] + (datum->syntax #f + (list (syntax-ize (car v) col) + c) + (list #f 1 col (+ 1 col) + (+ 1 (syntax-span c)))))] [(or (list? v) (vector? v)) (let* ([vec-sz (if (vector? v) @@ -621,30 +622,30 @@ (let ([i (syntax-ize (car v) col)]) (cons i (loop (+ col 1 (syntax-span i)) (cdr v))))))]) - (datum->syntax-object #f - (if (vector? v) - (short-list->vector v l) - l) - (list #f 1 col (+ 1 col) - (+ 2 - vec-sz - (if (zero? (length l)) - 0 - (sub1 (length l))) - (apply + (map syntax-span l)))))))] + (datum->syntax #f + (if (vector? v) + (short-list->vector v l) + l) + (list #f 1 col (+ 1 col) + (+ 2 + vec-sz + (if (zero? (length l)) + 0 + (sub1 (length l))) + (apply + (map syntax-span l)))))))] [(pair? v) (let* ([a (syntax-ize (car v) (+ col 1))] [sep (if (pair? (cdr v)) 0 3)] [b (syntax-ize (cdr v) (+ col 1 (syntax-span a) sep))]) - (datum->syntax-object #f - (cons a b) - (list #f 1 col (+ 1 col) - (+ 2 sep (syntax-span a) (syntax-span b)))))] + (datum->syntax #f + (cons a b) + (list #f 1 col (+ 1 col) + (+ 2 sep (syntax-span a) (syntax-span b)))))] [(box? v) (let ([a (syntax-ize (unbox v) (+ col 2))]) - (datum->syntax-object #f - (box a) - (list #f 1 col (+ 1 col) - (+ 2 (syntax-span a)))))] + (datum->syntax #f + (box a) + (list #f 1 col (+ 1 col) + (+ 2 (syntax-span a)))))] [else - (datum->syntax-object #f v (list #f 1 col (+ 1 col) 1))]))) + (datum->syntax #f v (list #f 1 col (+ 1 col) 1))]))) diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css index 160ff538..0604c3fe 100644 --- a/collects/scribble/scribble.css +++ b/collects/scribble/scribble.css @@ -2,7 +2,6 @@ body { color: black; background-color: #ffffff; - font-family: Times; } table td { @@ -10,44 +9,58 @@ padding-right: 0; } + .maincolumn { + font-family: "Courier", monospace; font-size: 13px; + width: 43em; + margin-right: -40em; + margin-left: 15em; + } + .main { - width: 35em; - margin-left: 12em; + font-family: serif; font-size: 16px; text-align: left; } .refpara { + font-family: "Courier", monospace; font-size: 13px; position: relative; float: right; left: 1em; top: -1em; height: 0em; - width: 10em; - margin: 0em -10em 0em 0em; + width: 13em; + margin: 0em -13em 0em 0em; } - .refcontent { + .refcolumn { background-color: #F5F5DC; display: block; position: relative; - width: 10em; + width: 13em; font-size: 85%; border: 0.5em solid #F5F5DC; } + .refcontent { + font-family: serif; font-size: 13px; + } + .tocset { + font-family: "Courier", monospace; font-size: 13px; position: relative; float: left; - width: 10em; + width: 12.5em; margin-right: 2em; } .tocview { + font-family: serif; font-size: 16px; text-align: left; background-color: #F5F5DC; } .tocsub { + font-family: serif; font-size: 16px; margin-top: 1em; text-align: left; background-color: #DCF5F5; @@ -227,6 +240,10 @@ list-style-type: upper-alpha; } + tt { + font-family: "Courier", monospace; font-size: 13px; + } + i { font-family: serif; } @@ -277,10 +294,10 @@ } .hspace { - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } - .smaller { + .small { font-size: 80%; } @@ -295,7 +312,7 @@ .schemeinput { color: brown; background-color: #eeeeee; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemeinputbg { @@ -303,22 +320,22 @@ } .schemereader { - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemeparen { color: #843c24; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schememeta { color: #262680; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schememod { color: black; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemeopt { @@ -328,7 +345,7 @@ .schemekeyword { color: black; font-weight: bold; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemeerror { @@ -339,12 +356,12 @@ .schemevariable { color: #262680; font-style: italic; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemesymbol { color: #262680; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemevaluelink { @@ -374,22 +391,22 @@ .schemeresult { color: #0000af; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemestdout { color: #960096; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemecomment { color: #c2741f; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .schemevalue { color: #228b22; - font-family: Courier; font-size: 80%; + font-family: "Courier", monospace; font-size: 13px; } .imageleft { diff --git a/collects/scribble/struct.ss b/collects/scribble/struct.ss index 0d608a43..c3a24062 100644 --- a/collects/scribble/struct.ss +++ b/collects/scribble/struct.ss @@ -1,7 +1,8 @@ -(module struct (lib "lang.ss" "big") - (require (lib "contract.ss") - (lib "serialize.ss")) +(module struct scheme/base + (require mzlib/serialize + scheme/contract + (for-syntax scheme/base)) ;; ---------------------------------------- @@ -50,8 +51,8 @@ v)) (provide - (struct collect-info (ht ext-ht parts tags gen-prefix)) - (struct resolve-info (ci delays undef)) + (struct-out collect-info) + (struct-out resolve-info) part-collected-info collect-put! resolve-get @@ -72,11 +73,11 @@ (letrec ([get-fields (lambda (super-id) (ormap (lambda (id fields+cts) (if (identifier? id) - (and (module-identifier=? id super-id) + (and (free-identifier=? id super-id) fields+cts) (syntax-case id () [(my-id next-id) - (module-identifier=? #'my-id super-id) + (free-identifier=? #'my-id super-id) #`[#,@(get-fields #'next-id) #,@fields+cts]] [_else #f]))) @@ -151,6 +152,7 @@ ;; Delayed element has special serialization support: (define-struct delayed-element (resolve sizer plain) + #:mutable #:property prop:serializable (make-serialize-info @@ -193,6 +195,7 @@ ;; ---------------------------------------- (define-struct (collect-element element) (collect) + #:mutable #:property prop:serializable (make-serialize-info @@ -235,7 +238,7 @@ (or (current-load-relative-directory) (current-directory)))) (provide - (struct generated-tag ())) + (struct-out generated-tag)) (provide deserialize-generated-tag) (define deserialize-generated-tag diff --git a/collects/scribblings/scribble/basic.scrbl b/collects/scribblings/scribble/basic.scrbl index aa19fcf1..d8bda673 100644 --- a/collects/scribblings/scribble/basic.scrbl +++ b/collects/scribblings/scribble/basic.scrbl @@ -1,7 +1,7 @@ -#reader(lib "docreader.ss" "scribble") -@require[(lib "manual.ss" "scribble")] +#lang scribble/doc +@require[scribble/manual] @require["utils.ss"] -@require-for-syntax[mzscheme] +@require[(for-syntax scheme/base)] @define-syntax[def-section-like (syntax-rules () @@ -21,7 +21,7 @@ @title[#:tag "basic"]{Basic Document Forms} -The @file{basic.ss} libraryprovides functions and forms that can be +The @filepath{basic.ss} libraryprovides functions and forms that can be used from code written either in Scheme or with @elem["@"] expressions. For example, the @scheme[title] and @scheme[italic] functions might be called from Scheme as @@ -40,7 +40,7 @@ EOS Although the procedures are mostly design to be used from @elem["@"] mode, they are easier to document in Scheme mode (partly because we -have Scribble's @file{scheme.ss} and @file{manual.ss}). +have Scribble's @filepath{scheme.ss} and @filepath{manual.ss}). @; ------------------------------------------------------------------------ diff --git a/collects/scribblings/scribble/decode.scrbl b/collects/scribblings/scribble/decode.scrbl index 0727542d..87ad60e6 100644 --- a/collects/scribblings/scribble/decode.scrbl +++ b/collects/scribblings/scribble/decode.scrbl @@ -1,13 +1,13 @@ -#reader(lib "docreader.ss" "scribble") -@require[(lib "manual.ss" "scribble")] +#lang scribble/doc +@require[scribble/manual] @require["utils.ss"] @title[#:tag "decode"]{Text Decoder} -The @file{decode.ss} library helps you write document content in a +The @filepath{decode.ss} library helps you write document content in a natural way---more like plain text, except for @litchar["@"] escapes. Roughly, it processes a stream of strings to produces instances of the -@file{struct.ss} datatypes (see @secref["struct"]). +@filepath{struct.ss} datatypes (see @secref["struct"]). At the flow level, decoding recognizes a blank line as a paragraph separator. At the paragraph-content level, decoding makes just a few diff --git a/collects/scribblings/scribble/doclang.scrbl b/collects/scribblings/scribble/doclang.scrbl index f23530c6..44bd1f3f 100644 --- a/collects/scribblings/scribble/doclang.scrbl +++ b/collects/scribblings/scribble/doclang.scrbl @@ -1,14 +1,14 @@ -#reader(lib "docreader.ss" "scribble") -@require[(lib "manual.ss" "scribble")] +#lang scribble/doc +@require[scribble/manual] @require["utils.ss"] @title[#:tag "doclang"]{Document Module Language} -The @file{doclang.ss} module is suitable for use as a module +The @filepath{doclang.ss} module is suitable for use as a module language. It provides everything from @scheme[mzscheme], except that it replaces the @scheme[#%module-begin] form. -The @file{doclang.ss} @scheme[#%module-begin] essentially packages the +The @filepath{doclang.ss} @scheme[#%module-begin] essentially packages the body of the module into a call to @scheme[decode], binds the result to @scheme[doc], and exports @scheme[doc]. diff --git a/collects/scribblings/scribble/docreader.scrbl b/collects/scribblings/scribble/docreader.scrbl index c5ccea2f..24a92d9c 100644 --- a/collects/scribblings/scribble/docreader.scrbl +++ b/collects/scribblings/scribble/docreader.scrbl @@ -1,13 +1,13 @@ -#reader(lib "docreader.ss" "scribble") -@require[(lib "manual.ss" "scribble")] -@require[(lib "bnf.ss" "scribble")] +#lang scribble/doc +@require[scribble/manual] +@require[scribble/bnf] @require["utils.ss"] @title[#:tag "docreader"]{Document Reader} -The @file{docreader.ss} module is suitable for use with +The @filepath{docreader.ss} module is suitable for use with @schemefont{#reader} at the beginning of a file. It reads the entire file with @scheme[read-inside-syntax] from Scribble's -@file{reader.ss}, and then wraps the result with @scheme[(module #, +@filepath{reader.ss}, and then wraps the result with @scheme[(module #, @nonterm{name} (lib "doclang.ss" "scribble") ...)], where @nonterm{name} is derived from the enclosing file's name. diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl index d168f358..d1972ce4 100644 --- a/collects/scribblings/scribble/eval.scrbl +++ b/collects/scribblings/scribble/eval.scrbl @@ -1,10 +1,10 @@ -#reader(lib "docreader.ss" "scribble") -@require[(lib "manual.ss" "scribble")] +#lang scribble/doc +@require[scribble/manual] @require["utils.ss"] @title[#:tag "eval"]{Evaluation and Examples} -The @file{eval.ss} library provides utilities for evaluating code at +The @filepath{eval.ss} library provides utilities for evaluating code at document-build time and incorporating the results in the document, especially to show example uses of defined procedures and syntax. diff --git a/collects/scribblings/scribble/how-to.scrbl b/collects/scribblings/scribble/how-to.scrbl index 880725a8..570d913b 100644 --- a/collects/scribblings/scribble/how-to.scrbl +++ b/collects/scribblings/scribble/how-to.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc -@require[(lib "manual.ss" "scribble") - (lib "bnf.ss" "scribble")] +@require[scribble/manual + scribble/bnf] @require["utils.ss"] @title{How to Scribble Documentation} @@ -13,13 +13,13 @@ To document a collection or @|PLaneT| package: @itemize{ @item{Create a file in your collection or planet package with the - file extension @file{.scrbl}. The remainder of these - instructions assume that the file is called @file{manual.scrbl}.} + file extension @filepath{.scrbl}. The remainder of these + instructions assume that the file is called @filepath{manual.scrbl}.} - @item{Start @file{manual.scrbl} like this: + @item{Start @filepath{manual.scrbl} like this: @verbatim[#<syntax-object + (datum->syntax p (reverse accum) (list (syntax-source p) @@ -77,7 +79,7 @@ (or second next-pos) (cons v accum)))]))] [else - (datum->syntax-object + (datum->syntax p (syntax-e p) (list (syntax-source p) @@ -101,9 +103,9 @@ (let ([str (substring lines p1 p2)]) (loop (cons (list str stx) r) (or newlines? (regexp-match? #rx#"\n" str)))) - (let* ([r (reverse! r)] + (let* ([r (reverse r)] [r (if newlines? - (cdr (apply append! (map (lambda (x) (list #f x)) r))) + (cdr (apply append (map (lambda (x) (list #f x)) r))) r)]) (make-table #f