X-Git-Url: http://git.kpe.io/?p=umlisp.git;a=blobdiff_plain;f=parse-macros.lisp;h=1b00ae50fbd5639e17f31096e5b25ae14a7858f1;hp=a775b0faf5a816f15372a7c23b87e6fdb1c7fdc3;hb=ddc4af5d96963df7c4df2706d752a1e1851ac86e;hpb=188873f068b0c53febe4ee0ededbc755fce4869d diff --git a/parse-macros.lisp b/parse-macros.lisp index a775b0f..1b00ae5 100644 --- a/parse-macros.lisp +++ b/parse-macros.lisp @@ -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) @@ -62,11 +64,16 @@ (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 files for ~A~%" (namestring ,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) + (locally (declare (type list ,line)) + ,@body)))))) (defmacro with-umls-ufile ((line ufile) &body body) "Opens a UMLS and processes each parsed line with (body) argument" @@ -74,7 +81,6 @@ ,@body)) (defmacro with-umls-file ((line ufile) &body body) - "Opens a UMLS and processes each parsed line with (body) argument" "Opens a UMLS and processes each parsed line with (body) argument" `(with-reading-umls-file (,line (umls-pathname ,ufile)) ,@body))