From d79db54a22892b1a927e40b510e5357ae52fbb44 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 4 Jul 2012 10:55:14 -0500 Subject: [PATCH] provide the color structs using (provide (struct-out ...)) closes PR 9867 --- collects/htdp/color-structs.rkt | 5 +++++ collects/htdp/htdp.scrbl | 14 ++++++++++++++ collects/htdp/image.rkt | 4 +--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 collects/htdp/color-structs.rkt diff --git a/collects/htdp/color-structs.rkt b/collects/htdp/color-structs.rkt new file mode 100644 index 0000000000..af95e9d103 --- /dev/null +++ b/collects/htdp/color-structs.rkt @@ -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) diff --git a/collects/htdp/htdp.scrbl b/collects/htdp/htdp.scrbl index bc1bdb43e7..8ad9d47cb8 100644 --- a/collects/htdp/htdp.scrbl +++ b/collects/htdp/htdp.scrbl @@ -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))]. +} diff --git a/collects/htdp/image.rkt b/collects/htdp/image.rkt index 177e333dad..0d765c6e4b 100644 --- a/collects/htdp/image.rkt +++ b/collects/htdp/image.rkt @@ -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))))