adjustment

main
Matthew Butterick 7 years ago
parent d6f2ca9ec7
commit 8c4a090e14

@ -1,3 +1,2 @@
#lang racket/base #lang s-exp "private/bootstrap.rkt"
(require "private/bootstrap.rkt") fr
(build-main fr)

@ -7,7 +7,7 @@
(only-in xml xexpr/c) (only-in xml xexpr/c)
(prefix-in core: hyphenate/private/core)) (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. ;; An exception-word is a string of word characters or hyphens.
(define (exception-word? x) (define (exception-word? x)
@ -53,17 +53,19 @@
(write-to-file (dynamic-require module-path id-sym) cache-path #:exists 'replace)) (write-to-file (dynamic-require module-path id-sym) cache-path #:exists 'replace))
(file->value cache-path)) (file->value cache-path))
(define-syntax (build-main stx) (define-syntax (mb stx)
(syntax-case stx () (syntax-case stx ()
[(_ DIR) [(_ DIR)
(let ([dir (symbol->string (syntax->datum #'DIR))]) (let* ([base (let-values ([(base name _) (split-path (syntax-source stx))])
(with-syntax ([PATTERNS-PATH (path->string (build-path dir "patterns.rkt"))] 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")] [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")] [EXCEPTIONS-CACHE-PATH (build-path dir "compiled" "exceptions-cache.rktd")]
[PATTERNS-ID 'patterns] [PATTERNS-ID 'patterns]
[EXCEPTIONS-ID 'exceptions]) [EXCEPTIONS-ID 'exceptions])
#'(begin #'(#%module-begin
(define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID)) (define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID))
;; a file-cached hash is immutable, so convert it ;; 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)))) (define EXCEPTIONS-ID (make-hash (hash->list (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID))))

@ -1,3 +1,2 @@
#lang racket/base #lang s-exp "private/bootstrap.rkt"
(require "private/bootstrap.rkt") us
(build-main us)
Loading…
Cancel
Save