X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=parse-macros.lisp;h=a2af75ef7a7bf38a66c015c315825d86b2cc3974;hb=8e895602ced5ab847ecc36c1eaa7be1c9a872a22;hp=6e006d816ef9a9fd4cd989b4c6cc7b949b8b8d92;hpb=b9fe7fe8b8e24133538f78dbaf6af73b5f0bdec2;p=umlisp.git diff --git a/parse-macros.lisp b/parse-macros.lisp index 6e006d8..a2af75e 100644 --- a/parse-macros.lisp +++ b/parse-macros.lisp @@ -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,15 @@ (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"