diff --git a/collects/games/chat-noir/README b/collects/games/chat-noir/README index 4f3d3f474f..dcaeb42182 100644 --- a/collects/games/chat-noir/README +++ b/collects/games/chat-noir/README @@ -14,3 +14,18 @@ Games. - literate-reader.ss: the reader used for chat-noir-literate.ss to put it into the literate-lang.ss. + +Problems: + + - the code is not hyperlinked in the scribble output-- this is due to + the confusion about how the requires should work in the two modes. + + - The char-noir-doc.ss file contains code that should move into + scribble proper; ideally that file should just be (something like): + + #lang scribble/doc + @include-literate["chat-noir-literate.ss"] + + and it should be built when setup-plt runs on this collection to + build the documentation, ie, this file should eventually be merged + together with ../scribblings/chat-noir.scrbl. diff --git a/collects/games/chat-noir/chat-noir-doc.ss b/collects/games/chat-noir/chat-noir-doc.ss index d7981e0f5c..f3692c937b 100644 --- a/collects/games/chat-noir/chat-noir-doc.ss +++ b/collects/games/chat-noir/chat-noir-doc.ss @@ -32,22 +32,6 @@ @;(require scheme/include) @;(include/reader "chat-noir-literate.ss" scr:read-syntax-inside) -@(define-syntax (content-elsewhere stx) - (syntax-case stx () - [(_ fn) - (string? (syntax-e #'fn)) - (let ([fn (syntax-e #'fn)]) - (register-external-file (path->complete-path fn)) - (call-with-input-file fn - (λ (port) - (port-count-lines! port) - (let ([reader-line (read-line port)]) - (unless (regexp-match #rx"^#reader" reader-line) - (raise-syntax-error #f (format "expected a #reader line, found ~s" reader-line) stx)) - (let* ([content (scr:read-syntax-inside fn port)] - [w/context (give-lexical-content stx content)]) - #`(begin #,@w/context))))))])) - @;{ stolen from include.ss. Should probably be refactored to just have one of these.} @(define-for-syntax (give-lexical-content ctx content) (let loop ([content content]) @@ -72,4 +56,21 @@ content content))]))) +@(define-syntax (content-elsewhere stx) + (syntax-case stx () + [(_ fn) + (string? (syntax-e #'fn)) + (let ([fn (syntax-e #'fn)]) + (register-external-file (path->complete-path fn)) + (call-with-input-file fn + (λ (port) + (port-count-lines! port) + (let ([reader-line (read-line port)]) + (unless (regexp-match #rx"^#reader" reader-line) + (raise-syntax-error #f (format "expected a #reader line, found ~s" reader-line) stx)) + (let* ([content (scr:read-syntax-inside fn port)] + [w/context (give-lexical-content stx content)]) + #`(begin #,@w/context))))))])) + + @content-elsewhere["chat-noir-literate.ss"] diff --git a/collects/games/chat-noir/chat-noir-literate.ss b/collects/games/chat-noir/chat-noir-literate.ss index 58c9687cf6..6f8d69fc9d 100644 --- a/collects/games/chat-noir/chat-noir-literate.ss +++ b/collects/games/chat-noir/chat-noir-literate.ss @@ -25,7 +25,7 @@ The main data structure for Chat Noir is @tt{world}. It consists of a structure with six fields: @itemize{ @item{ -a @scheme[board],} +a @scheme[board], which is represented as a list of @tt{cell}s, one for each circle on the game. } @item{ a @scheme[posn] for the cat,} @item{the state of the game (@scheme[state] below), which can be one of @@ -42,6 +42,13 @@ mouse is not in the window),} key has been pushed down.} } +A @tt{cell} is a structure with two fields: + +@chunk[ + (define-struct cell (p blocked?) #:transparent)] + +The first field contains a @scheme[posn] struct. + @verbatim[#<<--- ;; a cell is ;; (make-cell (make-posn int[0-board-size] @@ -50,8 +57,7 @@ key has been pushed down.} --- ] -@chunk[ - (define-struct cell (p blocked?) #:transparent)] + @section{Init Junk}