[2008-09-19 atsmyles@earthlink.net**20080919223529] hunk ./expander.scm 28 -;;; file-exists? and delete-file. hunk ./expander.scm 184 -;(define ex:expand-file #f) -;;;ATS added this -;(define ex:expand-file* #f) -;(define ex:compile-file #f) hunk ./expander.scm 185 -;(define ex:expand-r5rs-file #f) hunk ./expander.scm 186 -;(define ex:run-r6rs-program #f) hunk ./expander.scm 2252 - #;(define (run-r6rs-program filename) - (run-r6rs-sequence (read-file filename))) hunk ./expander.scm 2289 - ;; This may be used as a front end for the compiler. - ;; It expands a file consisting of a possibly empty sequence - ;; of libraries optionally followed by a . - ;; The result is a sequence of vanilla r5rs-like toplevel - ;; definitions and expressions. hunk ./expander.scm 2290 - #;(define (expand-file filename target-filename) - (reset-toplevel!) - (write-file (expand-toplevel-sequence (normalize (read-file filename))) - target-filename)) - -;;;ATS added this to allow expanding multiple files into one file - #;(define (expand-file* target-filename . files) - (reset-toplevel!) - (write-file (expand-toplevel-sequence (normalize - (let loop ((files files)) - (cond - ((pair? files) (append (read-file (car files)) (loop (cdr files)))) - ((null? files) '()))))) - target-filename)) - - #;(define (compile-file* filename . options) - (let ((forms (normalize (read-file filename)))) - (if (assoc 'program forms) - (make-r6rs-executable forms) - (make-r6rs-library forms options)))) - - #;(define (make-r6rs-executable forms) - #f) - - #;(define (make-r6rs-library forms options) - (define (library-name-part->string name) - (cond - ((pair? name) (map library-name-part>string name)) - ((null? name) "") - ((symbol? name) (symbol->string name)))) - - (define (library-filename name) - (if (null? (cdr name)) - (library-name-part->string (car name)) - (string-append (library-name-part->string (car name)) "-" (library-filename (cdr name))))) - - (if (pair? forms) - (let* ((library (car forms)) - (library-name (cadar forms)) - (file (library-filename library-name))) - (pp library) - (pp library-name) - (pp file) - (write-file (expand-toplevel-sequence (list library)) file) - (apply compile-file file options) - (make-r6rs-library (cdr forms))))) - - ;; This approximates the common r5rs behaviour of - ;; expanding a toplevel file but treating unbound identifiers - ;; as bare symbols that may refer to variables in the built-in toplevel - ;; environment. The environment argument should import at least the - ;; macros necessary to expand the file. - ;; This is provided mainly to be able to self-expand this expander - ;; metacircularly (see the relevant note at the top of this file). - ;; In contrast, expand-file strictly isolates a - ;; environment from the builtin environment and strictly disallows - ;; unbound identifiers. - ;; The resulting file will need the include file runtime.scm - ;; and the appropriate libraries that constitute the env argument - ;; to be preloaded before it can be run. - - #;(define (expand-r5rs-file filename target-filename r6rs-env) - (reset-toplevel!) - (fluid-let ((make-free-name (lambda (symbol) symbol)) - (*usage-env* (r6rs-environment-env r6rs-env)) - (*macro-table* *macro-table*)) - (let ((imported-libraries (r6rs-environment-imported-libraries r6rs-env))) - (import-libraries-for-expand (r6rs-environment-imported-libraries r6rs-env) (map not imported-libraries) 0) - (write-file (cons `(ex:import-libraries-for-run ',(r6rs-environment-imported-libraries r6rs-env) - ',(current-builds imported-libraries) - 0) - (expand-toplevel-sequence (read-file filename))) - target-filename)))) hunk ./expander.scm 2321 - #;(define (read-file fn) - (let ((p (open-input-file fn))) - (let f ((x (read p))) - (if (eof-object? x) - (begin (close-input-port p) '()) - (cons x - (f (read p))))))) hunk ./expander.scm 2322 - #;(define (write-file exps fn) - (if (file-exists? fn) - (delete-file fn)) - (let ((p (open-output-file fn))) - (for-each (lambda (exp) - (write exp p) - (newline p)) - exps) - (close-output-port p))) hunk ./expander.scm 2430 - ;(set! ex:expand-file expand-file) - ;(set! ex:expand-file* expand-file*) - ;(set! ex:compile-file compile-file*) hunk ./expander.scm 2431 - ;(set! ex:expand-r5rs-file expand-r5rs-file) hunk ./expander.scm 2432 - ;(set! ex:run-r6rs-program run-r6rs-program) hunk ./libs/srfi/srfi-9.scm 24 - ((define-record-field type field-tag accessor modifier) + ((define-record-field type field-tag accessor mutator) hunk ./libs/srfi/srfi-9.scm 27 - (define modifier (rtd-modifier type 'field-tag)))))) + (define mutator (rtd-mutator type 'field-tag))))))