Changeset 15772 in project for chicken


Ignore:
Timestamp:
09/07/09 12:26:11 (10 years ago)
Author:
felix
Message:

module-names in import forms and imports generated for import-libs are stripped; fix for -emit-all-import-libraries in csc; first go at reexport (not fully tested or documented, yet)

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/csc.scm

    r15770 r15772  
    131131    -no-symbol-escape -no-parentheses-synonyms -r5rs-syntax
    132132    -no-argc-checks -no-bound-checks -no-procedure-checks -no-compiler-syntax
     133    -emit-all-import-libraries
    133134    -no-procedure-checks-for-usual-bindings))
    134135
  • chicken/trunk/expand.scm

    r15543 r15772  
    825825;;; Macro definitions:
    826826
    827 (define (##sys#expand-import x r c import-env macro-env meta? loc)
     827(define (##sys#expand-import x r c import-env macro-env meta? reexp? loc)
    828828  (let ((%only (r 'only))
    829829        (%rename (r 'rename))
     
    834834    (define (tostr x)
    835835      (cond ((string? x) x)
    836             ((keyword? x) (##sys#string-append (##sys#symbol->string x) ":")) ; why not?
     836            ((keyword? x) (##sys#string-append (##sys#symbol->string x) ":")) ; hack
    837837            ((symbol? x) (##sys#symbol->string x))
    838838            ((number? x) (number->string x))
    839839            (else (syntax-error loc "invalid prefix" ))))
    840840    (define (import-name spec)
    841       (let* ((mname (resolve spec))
     841      (let* ((mname (##sys#strip-syntax spec))
    842842             (mod (##sys#find-module mname #f)))
    843843        (unless mod
     
    960960                (##sys#warn "re-importing already imported syntax" (car imp))) )
    961961            vss)
     962           (when reexp?
     963             (unless cm
     964               (syntax-error loc "`reexport' only valid inside a module"))
     965             (set-module-export-list!
     966              cm
     967              (append
     968               (module-export-list cm)
     969               (map car vsv)
     970               (map car vss)))
     971             (dm "export-list: " (module-export-list cm)))
    962972           (import-env (append vsv (import-env)))
    963973           (macro-env (append vss (macro-env)))))
     
    969979 (##sys#er-transformer
    970980  (cut ##sys#expand-import <> <> <> ##sys#current-environment ##sys#macro-environment
    971        #f 'import) ) )
     981       #f #f 'import) ) )
    972982
    973983(##sys#extend-macro-environment
     
    975985 (##sys#er-transformer
    976986  (cut ##sys#expand-import <> <> <> ##sys#current-meta-environment ##sys#meta-macro-environment
    977        #t 'import-for-syntax) ) )
     987       #t #f 'import-for-syntax) ) )
     988
     989(##sys#extend-macro-environment
     990 'reexport '()
     991 (##sys#er-transformer
     992  (cut ##sys#expand-import <> <> <> ##sys#current-environment ##sys#macro-environment
     993       #t #t 'reexport) ) )
    978994
    979995(define ##sys#initial-macro-environment (##sys#macro-environment))
     
    13261342       (append (module-export-list mod)
    13271343               (map ##sys#strip-syntax exps)))
    1328       '(##sys#void)))))
     1344      '(##core#undefined)))))
    13291345
    13301346
     
    15391555        (sexports (module-sexports mod))
    15401556        (mifs (module-meta-import-forms mod)))
    1541     `(,@(if (pair? ifs) `((eval '(import ,@ifs))) '())
    1542       ,@(if (pair? mifs) `((import ,@mifs)) '())
     1557    `(,@(if (pair? ifs) `((eval '(import ,@(##sys#strip-syntax ifs)))) '())
     1558      ,@(if (pair? mifs) `((import ,@(##sys#strip-syntax mifs))) '())
    15431559      ,@(reverse (map ##sys#strip-syntax (module-meta-expressions mod)))
    15441560      (##sys#register-compiled-module
Note: See TracChangeset for help on using the changeset viewer.