From 731053cd5f9e761e6d862c94a336a40e231610b1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 14 Sep 2001 00:41:36 +0000 Subject: [PATCH] . original commit: abd01d08f78e53f9e6e1aca0bdc85fed3fe42574 --- collects/mzlib/private/sigutil.ss | 10 ++++++---- collects/mzlib/unitsig.ss | 31 ++++++++++++++++++------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/collects/mzlib/private/sigutil.ss b/collects/mzlib/private/sigutil.ss index 4b3b27c..905e365 100644 --- a/collects/mzlib/private/sigutil.ss +++ b/collects/mzlib/private/sigutil.ss @@ -398,13 +398,13 @@ (caar renames)] [else (loop (cdr renames))])))) - (define (make-struct-stx-decls sig prefix src-stx check?) + (define (make-struct-stx-decls sig prefix init-prefix? src-stx check?) ;; If check? is #f, generates a syntax definition for %# for ;; each struct form in `sig'. Used for imports. ;; If check? is #t, generates an empty syntax "definition" that has ;; the side-effect of checking %# against its expected shape. ;; CURRENTLY, check? is always #f. - (let ([signame (and (or prefix (not check?)) + (let ([signame (and init-prefix? (signature-name sig))]) (append (apply @@ -416,6 +416,7 @@ (or prefix "") signame) prefix) + #t src-stx check?)) (filter signature? (signature-elems sig)))) @@ -630,11 +631,11 @@ (make-parse-unit imports renames vars - (lambda (src-stx) (apply append (map (lambda (i) (make-struct-stx-decls i #f src-stx #f)) imports))) + (lambda (src-stx) (apply append (map (lambda (i) (make-struct-stx-decls i #f #t src-stx #f)) imports))) body (lambda (src-stx) ;; Disabled until we have a mechanism for declaring precise information in signatures: - ; (make-struct-stx-decls sig #f src-stx #t) + ; (make-struct-stx-decls sig #f #f src-stx #t) null))] [(and (null? pre-lines) (not port) (not (pair? lines))) (syntax-error 'unit/sig expr "improper body list form")] @@ -1134,6 +1135,7 @@ parse-unit-body parse-unit-stx-checks + make-struct-stx-decls verify-struct-shape signature-vars diff --git a/collects/mzlib/unitsig.ss b/collects/mzlib/unitsig.ss index a640fb9..74b4b45 100644 --- a/collects/mzlib/unitsig.ss +++ b/collects/mzlib/unitsig.ss @@ -268,20 +268,25 @@ [ex-exploded (d->s ex-exploded)] [im-explodeds (d->s im-explodeds)] [im-flattened (d->s im-flattened)] - [formname formname]) + [formname formname] + [stx-decls (if (syntax-e (syntax global?)) + null + (make-struct-stx-decls ex-sig #f #f (syntax signame) #f))]) (syntax - (dv/iu - ex-flattened - (let ([unit-var unite]) - (verify-linkage-signature-match - 'formname - '(invoke) - (list unit-var) - '(ex-exploded) - '(im-explodeds)) - (unit/sig-unit unit-var)) - prefix - . im-flattened))))))))]))) + (begin + (dv/iu + ex-flattened + (let ([unit-var unite]) + (verify-linkage-signature-match + 'formname + '(invoke) + (list unit-var) + '(ex-exploded) + '(im-explodeds)) + (unit/sig-unit unit-var)) + prefix + . im-flattened) + . stx-decls))))))))]))) (define-syntax define-values/invoke-unit/sig (lambda (stx)