Starting to move macros for documenting Planet packages out of unstable.

I am leaving the bindings in unstable as they are, in case there are a few
packages out there relying on them.  My intention is to remove them after the
release of 5.1 so that developers on the trunk have a chance to find and fix
bugs in their Planet packages.

This commit: moved macro-facilitating functions from unstable/planet-syntax
to planet/syntax.
This commit is contained in:
Carl Eastlund 2011-01-05 16:11:05 -05:00
parent 2e05c118ba
commit 8d36436465

View File

@ -0,0 +1,53 @@
#lang racket/base
(provide make-planet-require-spec
syntax-source-planet-package
syntax-source-planet-package-owner
syntax-source-planet-package-name
syntax-source-planet-package-major
syntax-source-planet-package-minor
syntax-source-planet-package-symbol)
(require racket/match planet/util unstable/syntax)
(define (syntax-source-planet-package stx)
(let* ([dir (syntax-source-directory stx)])
(and dir (path->package-version dir))))
(define (syntax-source-planet-package-owner stx)
(match (syntax-source-planet-package stx)
[(list owner name major minor) owner]
[_ #f]))
(define (syntax-source-planet-package-name stx)
(match (syntax-source-planet-package stx)
[(list owner name major minor) name]
[_ #f]))
(define (syntax-source-planet-package-major stx)
(match (syntax-source-planet-package stx)
[(list owner name major minor) major]
[_ #f]))
(define (syntax-source-planet-package-minor stx)
(match (syntax-source-planet-package stx)
[(list owner name major minor) minor]
[_ #f]))
(define (syntax-source-planet-package-symbol stx [suffix #f])
(match (syntax-source-planet-package stx)
[(list owner name major minor)
(string->symbol
(format "~a/~a:~a:~a~a"
owner
(regexp-replace "\\.plt$" name "")
major
minor
(if suffix (format-symbol "/~a" suffix) "")))]
[#f #f]))
(define (make-planet-require-spec stx id/f)
(datum->syntax
stx
(list #'planet (syntax-source-planet-package-symbol stx id/f))
(or id/f stx)))