diff --git a/hyphenate/hyphenate/fr.rkt b/hyphenate/hyphenate/fr.rkt index e3d4d639..6aa78a98 100644 --- a/hyphenate/hyphenate/fr.rkt +++ b/hyphenate/hyphenate/fr.rkt @@ -1,3 +1,2 @@ -#lang racket/base -(require "private/bootstrap.rkt") -(build-main fr) \ No newline at end of file +#lang s-exp "private/bootstrap.rkt" +fr \ No newline at end of file diff --git a/hyphenate/hyphenate/private/bootstrap.rkt b/hyphenate/hyphenate/private/bootstrap.rkt index a5abdd65..a2aa9939 100644 --- a/hyphenate/hyphenate/private/bootstrap.rkt +++ b/hyphenate/hyphenate/private/bootstrap.rkt @@ -7,7 +7,7 @@ (only-in xml xexpr/c) (prefix-in core: hyphenate/private/core)) -(provide build-main) +(provide (rename-out [mb #%module-begin]) #%top-interaction #%top #%datum #%app) ;; An exception-word is a string of word characters or hyphens. (define (exception-word? x) @@ -53,17 +53,19 @@ (write-to-file (dynamic-require module-path id-sym) cache-path #:exists 'replace)) (file->value cache-path)) -(define-syntax (build-main stx) +(define-syntax (mb stx) (syntax-case stx () [(_ DIR) - (let ([dir (symbol->string (syntax->datum #'DIR))]) - (with-syntax ([PATTERNS-PATH (path->string (build-path dir "patterns.rkt"))] + (let* ([base (let-values ([(base name _) (split-path (syntax-source stx))]) + base)] + [dir (build-path base (symbol->string (syntax->datum #'DIR)))]) + (with-syntax ([PATTERNS-PATH (build-path dir "patterns.rkt")] [PATTERN-CACHE-PATH (build-path dir "compiled" "patterns-cache.rktd")] - [EXCEPTIONS-PATH (path->string (build-path dir "exceptions.rkt"))] + [EXCEPTIONS-PATH (build-path dir "exceptions.rkt")] [EXCEPTIONS-CACHE-PATH (build-path dir "compiled" "exceptions-cache.rktd")] [PATTERNS-ID 'patterns] [EXCEPTIONS-ID 'exceptions]) - #'(begin + #'(#%module-begin (define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID)) ;; a file-cached hash is immutable, so convert it (define EXCEPTIONS-ID (make-hash (hash->list (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID)))) diff --git a/hyphenate/hyphenate/us.rkt b/hyphenate/hyphenate/us.rkt index 2e031840..5978a3d8 100644 --- a/hyphenate/hyphenate/us.rkt +++ b/hyphenate/hyphenate/us.rkt @@ -1,3 +1,2 @@ -#lang racket/base -(require "private/bootstrap.rkt") -(build-main us) \ No newline at end of file +#lang s-exp "private/bootstrap.rkt" +us \ No newline at end of file