Skip to content
Browse files

documentation doesn't seem to be generating error messages anymore.

  • Loading branch information...
1 parent c584e5d commit 0e0ebd6f96648201861a470f449b7c93b722b0f8 Danny Yoo committed Aug 10, 2011
View
4 main.rkt
@@ -0,0 +1,4 @@
+#lang racket/base
+
+(require "version-case.rkt")
+(provide (all-from-out "version-case.rkt"))
View
3 main.ss
@@ -1,3 +0,0 @@
-(module main mzscheme
- (require "version-case.ss")
- (provide (all-from "version-case.ss")))
View
10 private/new-version-case.ss → private/new-version-case.rkt
@@ -1,11 +1,11 @@
-#lang scheme/base
+#lang racket/base
-(require (for-syntax scheme/base)
- (for-syntax scheme/bool)
- (for-syntax "../version-misc.ss"))
+(require (for-syntax racket/base)
+ (for-syntax racket/bool)
+ (for-syntax "../version-misc.rkt"))
-(provide (for-syntax (all-from-out "../version-misc.ss")))
+(provide (for-syntax (all-from-out "../version-misc.rkt")))
(provide version-case)
View
2 private/old-version-case.ss → private/old-version-case.rkt
@@ -1,5 +1,5 @@
(module old-version-case mzscheme
- (require-for-syntax (prefix m: "../version-misc.ss"))
+ (require-for-syntax (prefix m: "../version-misc.rkt"))
(provide version-case)
View
51 test-version-case.rkt
@@ -0,0 +1,51 @@
+#lang racket
+(require "version-case.rkt"
+ racket/gui/base)
+
+;; Small test code to see that we can write unit-dependent code
+;; that still runs under both 360 and 369.
+
+;; version-case should be usable in expression position
+(printf "~s~n" (version-case [(version= (version) "360")
+ "360"]
+ [else
+ "something else"]))
+
+
+;; Ellipses should work in a version case.
+(printf "~s~n"
+ (map syntax-e (syntax->list
+ (version-case
+ (#f blah)
+ (else
+ (syntax-case (syntax (foo bar)) ()
+ [(x ...)
+ (syntax (x ...))]))))))
+;; we expect '(foo bar)
+
+
+(version-case
+ [(version<= (version) "360")
+ (printf "old unit code~n")
+ (require (lib "tool.ss" "drscheme")
+ (lib "unitsig.ss"))
+
+ (define tool@
+ (unit/sig drscheme:tool-exports^
+ (import drscheme:tool^)
+ (define (phase1)
+ (message-box "phase1"))
+ (define (phase2)
+ (message-box "phase2"))))]
+
+ [else
+ (printf "new unit code~n")
+ (require (lib "tool.ss" "drscheme")
+ (lib "unit.ss"))
+ (define-unit tool@
+ (import drscheme:tool^)
+ (export drscheme:tool-exports^)
+ (define (phase1)
+ (message-box "phase1"))
+ (define (phase2)
+ (message-box "phase2")))])
View
51 test-version-case.ss
@@ -1,51 +0,0 @@
-(module test-version-case mzscheme
- (require "version-case.ss"
- (lib "mred.ss" "mred"))
-
- ;; Small test code to see that we can write unit-dependent code
- ;; that still runs under both 360 and 369.
-
- ;; version-case should be usable in expression position
- (printf "~s~n" (version-case [(version= (version) "360")
- "360"]
- [else
- "something else"]))
-
-
- ;; Ellipses should work in a version case.
- (printf "~s~n"
- (map syntax-e (syntax->list
- (version-case
- (#f blah)
- (else
- (syntax-case (syntax (foo bar)) ()
- [(x ...)
- (syntax (x ...))]))))))
- ;; we expect '(foo bar)
-
-
- (version-case
- [(version<= (version) "360")
- (printf "old unit code~n")
- (require (lib "tool.ss" "drscheme")
- (lib "unitsig.ss"))
-
- (define tool@
- (unit/sig drscheme:tool-exports^
- (import drscheme:tool^)
- (define (phase1)
- (message-box "phase1"))
- (define (phase2)
- (message-box "phase2"))))]
-
- [else
- (printf "new unit code~n")
- (require (lib "tool.ss" "drscheme")
- (lib "unit.ss"))
- (define-unit tool@
- (import drscheme:tool^)
- (export drscheme:tool-exports^)
- (define (phase1)
- (message-box "phase1"))
- (define (phase2)
- (message-box "phase2")))]))
View
39 version-case.rkt
@@ -0,0 +1,39 @@
+#lang racket/base
+(require (for-syntax "version-misc.rkt"
+ racket/base))
+
+;; version-case: SYNTAX
+;; Conditionally include code based on current version number.
+;; Usage:
+;;
+;; (version-case [clause code] ...
+;; [else ...])
+;;
+;; where clause has access to the mzscheme primitives. In addition,
+;; the following functions are available:
+;;
+;; version<=: string string -> boolean
+;; version>=: string string -> boolean
+;; version=: string string -> boolean
+;; version<: string string -> boolean
+;; version>: string string -> boolean
+;;
+;; to make it easier to build the conditional clauses.
+
+
+;; We choose at compile time of version-case which implementation can be used.
+(define-syntax (choose-version-case-implementation stx)
+ (cond
+ [(version< (version) "399")
+ (syntax/loc stx
+ (begin
+ (require "private/old-version-case.rkt")
+ (provide (all-from-out "private/old-version-case.rkt"))))]
+ [else
+ (syntax/loc stx
+ (begin
+ (require "private/new-version-case.rkt")
+ (provide (all-from-out "private/new-version-case.rkt"))))]))
+
+
+(choose-version-case-implementation)
View
3 version-case.scrbl
@@ -67,7 +67,7 @@ Another simple example:
@section{Usage}
-@defmodule/this-package[main]
+@declare-exporting/this-package[main]
@defform[(version-case [test code ...]
...
[else code ...])]
@@ -76,7 +76,6 @@ Another simple example:
@racket[test] expression is evaluated at compile-time. Some
version-comparing functions are available for convenience.
-@declare-exporting/this-package[version-misc]
@defproc[(version< [v1 string?] [v2 string?]) boolean?]{
Returns true if @racket[v1] is less than @racket[v2].
}
View
38 version-case.ss
@@ -1,38 +0,0 @@
-(module version-case mzscheme
- (require-for-syntax "version-misc.ss")
-
- ;; version-case: SYNTAX
- ;; Conditionally include code based on current version number.
- ;; Usage:
- ;;
- ;; (version-case [clause code] ...
- ;; [else ...])
- ;;
- ;; where clause has access to the mzscheme primitives. In addition,
- ;; the following functions are available:
- ;;
- ;; version<=: string string -> boolean
- ;; version>=: string string -> boolean
- ;; version=: string string -> boolean
- ;; version<: string string -> boolean
- ;; version>: string string -> boolean
- ;;
- ;; to make it easier to build the conditional clauses.
-
-
- ;; We choose at compile time of version-case which implementation can be used.
- (define-syntax (choose-version-case-implementation stx)
- (cond
- [(version< (version) "399")
- (syntax/loc stx
- (begin
- (require "private/old-version-case.ss")
- (provide (all-from "private/old-version-case.ss"))))]
- [else
- (syntax/loc stx
- (begin
- (require "private/new-version-case.ss")
- (provide (all-from "private/new-version-case.ss"))))]))
-
-
- (choose-version-case-implementation))
View
0 version-misc.ss → version-misc.rkt
File renamed without changes.

0 comments on commit 0e0ebd6

Please sign in to comment.
Something went wrong with that request. Please try again.