r11209: fix test
[umlisp.git] / parse-macros.lisp
index bf784c202e25432b00fc7501c90918464a07bfdd..a2af75ef7a7bf38a66c015c315825d86b2cc3974 100644 (file)
@@ -10,7 +10,7 @@
 ;;;; $Id$
 ;;;;
 ;;;; This file, part of UMLisp, is
-;;;;    Copyright (c) 2000-2004 by Kevin M. Rosenberg, M.D.
+;;;;    Copyright (c) 2000-2006 by Kevin M. Rosenberg, M.D.
 ;;;;
 ;;;; UMLisp users are granted the rights to distribute and use this software
 ;;;; as governed by the terms of the GNU General Public License.
@@ -26,7 +26,7 @@
        (delimited-string-to-list line #\| t))))
 
 (defun source-files (path)
-  (if (probe-file path) 
+  (if (probe-file path)
       (list path)
     (sort
      (directory (make-pathname :defaults path
@@ -47,7 +47,9 @@
     `(let ((,eof (gensym "EOFSYM-"))
           (,buffer (make-fields-buffer))
           (,files (source-files ,path)))
-       (with-open-file (,ustream (first ,files) :direction :input)
+       (with-open-file (,ustream (first ,files) :direction :input
+                        #+(and clisp unicode) :external-format
+                        #+(and clisp unicode) charset:utf-8)
         (do ((,line (read-buffered-fields ,buffer ,ustream #\| ,eof)
                     (read-buffered-fields ,buffer ,ustream #\| ,eof)))
             ((eq ,line ,eof) t)
        (files (gensym "FILES-")))
     `(let ((,eof (gensym "EOFSYM-"))
           (,files (source-files ,path)))
-       (with-open-file (,ustream (first ,files) :direction :input)
-        (do ((,line (read-umls-line ,ustream ,eof)
-                    (read-umls-line ,ustream ,eof)))
-            ((eq ,line ,eof) t)
-          ,@body)))))
+      (unless ,files
+        (error "Can't find file files for ~A~%" ,path))
+      (with-open-file (,ustream (first ,files) :direction :input
+                       #+(and clisp unicode) :external-format
+                       #+(and clisp unicode) charset:utf-8)
+        (do ((,line (read-umls-line ,ustream ,eof)
+                    (read-umls-line ,ustream ,eof)))
+            ((eq ,line ,eof) t)
+          ,@body)))))
 
 (defmacro with-umls-ufile ((line ufile) &body body)
   "Opens a UMLS and processes each parsed line with (body) argument"