From fd2acba3d2eac5a76aa65ed6888a0c2964ff6b55 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 9 Apr 2013 12:57:58 -0600 Subject: [PATCH] plai/{gc2/}mutator: doc fixes A symptom of mismatched `for-label' imports was that searching for "<=" would show red-underlined links to the `plai/{gc2/}mutator' documentation. Merge to v5.3.4 (cherry picked from commit de9b77ad6d68df749ba23f77b273d1b42b06bc86) --- collects/plai/scribblings/collector2.scrbl | 7 ++- collects/plai/scribblings/mutator.scrbl | 56 ++++++++++------------ collects/plai/scribblings/mutator2.scrbl | 49 +++++++++---------- 3 files changed, 52 insertions(+), 60 deletions(-) diff --git a/collects/plai/scribblings/collector2.scrbl b/collects/plai/scribblings/collector2.scrbl index 38330f6770..6cf5f5c20c 100644 --- a/collects/plai/scribblings/collector2.scrbl +++ b/collects/plai/scribblings/collector2.scrbl @@ -23,9 +23,8 @@ heap-value? heap-set! heap-ref with-heap get-root-set read-root set-root! make-root) - plai/scribblings/fake-collector - plai/scribblings/fake-mutator - plai/scribblings/fake-web + plai/scribblings/fake-collector2 + plai/scribblings/fake-mutator2 plai/random-mutator (only-in plai/web no-web-browser @@ -39,7 +38,7 @@ printf))) -@title[#:tag "gc2-collector"]{GC Collector, 2} +@title[#:tag "gc2-collector"]{GC Collector Language, 2} @defmodulelang[plai/gc2/collector] diff --git a/collects/plai/scribblings/mutator.scrbl b/collects/plai/scribblings/mutator.scrbl index 6d5698ded5..596be5a5c9 100644 --- a/collects/plai/scribblings/mutator.scrbl +++ b/collects/plai/scribblings/mutator.scrbl @@ -4,18 +4,14 @@ "plai-exports.rkt" "lang-names.rkt" (for-syntax scheme) - (for-label (except-in scheme - error printf) - (prefix-in scheme: - scheme) - (only-in plai/main - type-case define-type error - test test/pred test/exn test/regexp - abridged-test-output - plai-catch-test-exn - halt-on-errors print-only-errors - test-inexact-epsilon plai-ignore-exn-strings - plai-all-test-results) + (for-label (only-in racket/base + list modulo + procedure? path-string? + input-port? string? void? + exact-nonnegative-integer? + exact-positive-integer?) + (only-in racket/contract/base + or/c listof any/c) (only-in plai/collector root? heap-size @@ -31,13 +27,7 @@ (only-in plai/web no-web-browser static-files-path) - (only-in plai/mutator - set-first! - set-rest! - import-primitives - test/location=? - test/value=? - printf))) + plai/mutator)) @title[#:tag "mutator"]{@MUTATE-LANG} @@ -59,9 +49,9 @@ The first expression of a mutator must be: @defform/subs[ (allocator-setup collector-module heap-size) -([heap-size exact-nonnegative-integer?])]{ +([heap-size exact-nonnegative-integer])]{ -@racket[_collector-module] specifies the path to the garbage collector that the +The @racket[_collector-module] form specifies the path to the garbage collector that the mutator should use. The collector must be written in the @COLLECT-LANG language. } @@ -77,9 +67,12 @@ as @racket[gc:cons], written in the collector. The @MUTATE-LANG language supports the following procedures and syntactic forms: +@(define-syntax-rule (defprocthing id content ...) + @defthing[id procedure? content ...]) + @(define-syntax (document/lift stx) (syntax-case stx () - [(_ a ...) + [(_ defidform a ...) (with-syntax ([(doc ...) (map (λ (a) (with-syntax ([a a] @@ -90,7 +83,8 @@ forms: #'(begin doc ...))])) -@document/lift[if and or cond case define-values let let-values let* set! quote error begin] +@document/lift[defidform + if and or cond case define-values let let-values let* set! quote begin] @defform[(define (id arg-id ...) body-expression ...+)]{ Just like Racket's @racket[define], except restricted to the simpler form @@ -102,7 +96,9 @@ forms: simpler form above. } -@document/lift[add1 sub1 zero? + - * / even? odd? = < > <= >= +@document/lift[defprocthing + error + add1 sub1 zero? + - * / even? odd? = < > <= >= symbol? symbol=? number? boolean? empty? eq?] @defproc[(cons [hd any/c] [tl any/c]) cons?]{ @@ -120,25 +116,25 @@ forms: } @defproc[(set-first! [c cons?] [v any/c]) - void]{ + void?]{ Sets the @racket[first] of the cons cell @racket[c]. } @defproc[(set-rest! [c cons?] [v any/c]) - void]{ + void?]{ Sets the @racket[rest] of the cons cell @racket[c]. } @defidform[empty]{ The identifier @racket[empty] is defined to invoke - @racket[(gc:alloc-flat empty)] wherever it is used. + @racket[(gc:alloc-flat '())] wherever it is used. } -@defidform[print-only-errors]{ +@defprocthing[print-only-errors]{ Behaves like PLAI's @|plai:print-only-errors|. } -@defidform[halt-on-errors]{ +@defprocthing[halt-on-errors]{ Behaves like PLAI's @|plai:halt-on-errors|. } @@ -253,7 +249,7 @@ of random mutators: (listof heap-value?)]{ Processes @racket[input] looking for occurrences of @racket[heap-value?]s in the source of the program and returns them. This makes a good start for the - @racket[heap-values] argument to @racket[save-random-mutator]. + @racket[_heap-values] argument to @racket[save-random-mutator]. If @racket[input] is a port, its contents are assumed to be a well-formed PLAI program. If @racket[input] is a file, the contents of the file are used. diff --git a/collects/plai/scribblings/mutator2.scrbl b/collects/plai/scribblings/mutator2.scrbl index 65257f2a2e..5cd32030f7 100644 --- a/collects/plai/scribblings/mutator2.scrbl +++ b/collects/plai/scribblings/mutator2.scrbl @@ -5,18 +5,14 @@ "lang-names.rkt" scribble/decode (for-syntax scheme) - (for-label (except-in scheme - error printf) - (prefix-in scheme: - scheme) - (only-in plai/main - type-case define-type error - test test/pred test/exn test/regexp - abridged-test-output - plai-catch-test-exn - halt-on-errors print-only-errors - test-inexact-epsilon plai-ignore-exn-strings - plai-all-test-results) + (for-label (only-in racket/base + list modulo + procedure? path-string? + input-port? string? void? + exact-nonnegative-integer? + exact-positive-integer?) + (only-in racket/contract/base + or/c listof any/c) (only-in plai/collector root? heap-size @@ -25,17 +21,13 @@ heap-set! heap-ref with-heap get-root-set read-root set-root! procedure-roots) + plai/scribblings/fake-collector2 + plai/scribblings/fake-mutator2 plai/random-mutator (only-in plai/web no-web-browser static-files-path) - (only-in plai/mutator - set-first! - set-rest! - import-primitives - test/location=? - test/value=? - printf))) + plai/gc2/mutator)) @title[#:tag "gc2-mutator"]{GC Mutator Language, 2} @@ -57,7 +49,7 @@ The first expression of a mutator must be: @defform/subs[ (allocator-setup collector-module heap-size) -([heap-size exact-nonnegative-integer?])]{ +([heap-size exact-nonnegative-integer])]{ @racket[_collector-module] specifies the path to the garbage collector that the mutator should use. The collector must be written in the @COLLECT-LANG @@ -75,9 +67,12 @@ as @racket[gc:cons], written in the collector. The @MUTATE-LANG language supports the following procedures and syntactic forms: +@(define-syntax-rule (defprocthing id content ...) + @defthing[id procedure? content ...]) + @(define-syntax (document/lift stx) (syntax-case stx () - [(_ a ...) + [(_ defidform a ...) (with-syntax ([(doc ...) (for/list ([a (in-list (syntax->list #'(a ...)))]) (syntax-case a () @@ -92,12 +87,13 @@ forms: #'(begin doc ...))])) -@document/lift[if and or cond case define-values let let-values let* +@document/lift[defidform + if and or cond case define-values let let-values let* (set! @splice[@list{Unlike Racket's @|rkt:set!|, this @racket[set!] is syntactically allowed only in positions that discard its result, e.g., at the top-level or in a @racket[begin] expression (although not as the last expression in a @racket[begin]).}]) - quote error begin] + quote begin] @defform[(define (id arg-id ...) body-expression ...+)]{ Just like Racket's @racket[define], except restricted to the simpler form @@ -109,7 +105,8 @@ forms: simpler form above. } -@document/lift[add1 sub1 zero? + - * / even? odd? = < > <= >= +@document/lift[defprocthing + error add1 sub1 zero? + - * / even? odd? = < > <= >= symbol? symbol=? number? boolean? empty? eq?] @defproc[(cons [hd any/c] [tl any/c]) cons?]{ @@ -153,7 +150,7 @@ forms: @defidform[empty]{ The identifier @racket[empty] is defined to invoke - @racket[(gc:alloc-flat empty)] wherever it is used. + @racket[(gc:alloc-flat '())] wherever it is used. } @defidform[print-only-errors]{ @@ -275,7 +272,7 @@ of random mutators: (listof heap-value?)]{ Processes @racket[input] looking for occurrences of @racket[heap-value?]s in the source of the program and returns them. This makes a good start for the - @racket[heap-values] argument to @racket[save-random-mutator]. + @racket[_heap-values] argument to @racket[save-random-mutator]. If @racket[input] is a port, its contents are assumed to be a well-formed PLAI program. If @racket[input] is a file, the contents of the file are used.