Change cref/generate-trivial-constructor to default os-types compatibly.
authorChris Hanson <org/chris-hanson/cph>
Tue, 23 Oct 2018 21:08:56 +0000 (14:08 -0700)
committerChris Hanson <org/chris-hanson/cph>
Tue, 23 Oct 2018 21:08:56 +0000 (14:08 -0700)
src/cref/toplev.scm
src/edwin/edwin.sf

index 2223c9e120e4a7182020df3c7c14a5f01030c28b..c6cdbce6d51363189559e2b8959b48697d5807d0 100644 (file)
@@ -30,35 +30,28 @@ USA.
 \f
 (define (generate/common kernel)
   (lambda (filename #!optional os-type)
-    (let ((do-type
-          (let ((pathname (merge-pathnames filename)))
-            (lambda (os-type)
-              (let ((pmodel (read-package-model pathname os-type)))
-                (let ((changes? (read-file-analyses! pmodel os-type)))
-                  (resolve-references! pmodel)
-                  (kernel pathname pmodel changes? os-type)))))))
-      (cond ((default-object? os-type) (do-type microcode-id/operating-system))
-           ((eq? os-type 'all) (for-each do-type os-types))
-           ((memq os-type os-types) (do-type os-type))
-           (else (error:bad-range-argument os-type #f))))))
+    (for-each-os-type os-type
+      (let ((pathname (merge-pathnames filename)))
+       (lambda (os-type)
+         (let ((pmodel (read-package-model pathname os-type)))
+           (let ((changes? (read-file-analyses! pmodel os-type)))
+             (resolve-references! pmodel)
+             (kernel pathname pmodel changes? os-type))))))))
 
 (define (cref/generate-trivial-constructor filename #!optional os-type)
-  (let* ((pathname (merge-pathnames filename))
-        (do-type
-         (lambda (os-type)
-           (write-external-descriptions
-            pathname
-            (read-package-model pathname os-type)
-            #f
-            os-type))))
-    (cond ((or (default-object? os-type)
-              (eq? os-type 'all))
-          (for-each do-type os-types))
-         ((eq? os-type #f)
-          (do-type microcode-id/operating-system))
-         ((memq os-type os-types)
-          (do-type os-type))
-         (else (error:bad-range-argument os-type #f)))))
+  (for-each-os-type os-type
+    (let ((pathname (merge-pathnames filename)))
+      (lambda (os-type)
+       (write-external-descriptions pathname
+                                    (read-package-model pathname os-type)
+                                    #f
+                                    os-type)))))
+
+(define (for-each-os-type os-type procedure)
+  (cond ((default-object? os-type) (procedure microcode-id/operating-system))
+       ((eq? os-type 'all) (for-each procedure os-types))
+       ((memq os-type os-types) (procedure os-type))
+       (else (error:bad-range-argument os-type #f))))
 
 (define (cref/package-files filename os-type)
   (append-map package/files
index f2aad22d7e66ae7935a91ba870eef59f44c26a47..35b4ce7443ba29b2bed4c909bf83f35cdcdbfa69 100644 (file)
@@ -29,7 +29,7 @@ USA.
 (if (not (name->package '(edwin)))
     (let ((package-set (package-set-pathname "edwin")))
       (if (not (file-exists? package-set))
-         (cref/generate-trivial-constructor "edwin" #f))
+         (cref/generate-trivial-constructor "edwin"))
       (construct-packages-from-file (fasload package-set))))
 
 (if (lexical-unreferenceable? (->environment '(edwin string))