provide the color structs using (provide (struct-out ...))

closes PR 9867
This commit is contained in:
Robby Findler 2012-07-04 10:55:14 -05:00
parent 983afd5355
commit d79db54a22
3 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,5 @@
#lang racket/base
(provide (struct-out color)
(struct-out alpha-color))
(define-struct color (red green blue) #:transparent)
(define-struct alpha-color (alpha red green blue) #:transparent)

View File

@ -2,6 +2,7 @@
@(require scribble/manual
(for-label [except-in racket require]
htdp/color-structs
[only-in lang/htdp-beginner require]))
@title[#:style 'toc #:tag "htdp"]{Implementing HtDP Teachpacks, Libraries, and Customized Teaching Languages}
@ -58,3 +59,16 @@ of DrRacket's teaching languages.
@include-section["error-reporting.scrbl"]
@include-section["testing.scrbl"]
@include-section["htdp-lib.scrbl"]
@section{Color and Alpha Color Structs}
@defmodule[htdp/color-structs]
@defstruct[color ([red any/c] [green any/c] [blue any/c])]{
This is the color sturct that is also exported by @racketmodname[htdp/image],
but here it is exported via @racket[(provide (struct-out color))].
}
@defstruct[alpha-color ([alpha any/c] [red any/c] [green any/c] [blue any/c])]{
This is the color sturct that is also exported by @racketmodname[htdp/image],
but here it is exported via @racket[(provide (struct-out alpha-color))].
}

View File

@ -16,6 +16,7 @@ plt/collects/tests/mzscheme/htdp-image.rkt
lang/prim
lang/posn
lang/private/imageeq
"color-structs.rkt"
"error.rkt")
(provide-primitives
@ -77,9 +78,6 @@ plt/collects/tests/mzscheme/htdp-image.rkt
(define (alpha-color-list? l)
(and (list? l) (andmap alpha-color? l)))
(define-struct color (red green blue) #:inspector (make-inspector))
(define-struct alpha-color (alpha red green blue) #:inspector (make-inspector))
;; ----------------------------------------
(define (to-exact-int x) (floor0 (if (exact? x) x (inexact->exact x))))