svn: r13614

This commit is contained in:
Robby Findler 2009-02-15 21:05:03 +00:00
parent e99c3dc3d9
commit 965110bc55
3 changed files with 41 additions and 19 deletions

View File

@ -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.

View File

@ -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"]

View File

@ -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[<data-definitions>
(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[<data-definitions>
(define-struct cell (p blocked?) #:transparent)]
@section{Init Junk}