X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=parse-macros.lisp;h=65a608cf42d694d6d5c082566918a4c1af63157b;hb=cc0d0f58d7261d12a8d6a89153f58ea693618e79;hp=d35628291d885b65f903c3c95026eec7559bf98b;hpb=58e6e7e38d835e51beb5f21440b4b7bd27d106f2;p=umlisp.git diff --git a/parse-macros.lisp b/parse-macros.lisp index d356282..65a608c 100644 --- a/parse-macros.lisp +++ b/parse-macros.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: parse-macros.lisp,v 1.3 2003/05/05 23:13:28 kevin Exp $ +;;;; $Id: parse-macros.lisp,v 1.4 2003/05/06 01:34:57 kevin Exp $ ;;;; ;;;; This file, part of UMLisp, is ;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. @@ -16,41 +16,43 @@ ;;;; as governed by the terms of the GNU General Public License. ;;;; ************************************************************************* -(in-package :umlisp) -(declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) +(in-package #:umlisp) (defmacro with-umls-file ((line filename) &body body) "Opens a UMLS and processes each parsed line with (body) argument" - (let ((ustream (gensym))) + (let ((ustream (gensym "STRM-")) + (eof (gensym "EOF-"))) `(with-open-file - (,ustream (umls-pathname ,filename) - :direction :input :if-exists :overwrite) - (do ((,line (read-umls-line ,ustream) (read-umls-line ,ustream))) - ((eq ,line 'eof) t) - ,@body)))) + (,ustream (umls-pathname ,filename) :direction :input) + (do ((,line (read-umls-line ,ustream ,eof) + (read-umls-line ,ustream ,eof))) + ((eq ,line 'eof) t) + ,@body)))) (defmacro with-buffered-umls-file ((line filename) &body body) -"Opens a UMLS and processes each parsed line with (body) argument" - (let ((ustream (gensym)) - (buffer (gensym))) + "Opens a UMLS and processes each parsed line with (body) argument" + (let ((ustream (gensym "STRM-")) + (buffer (gensym "BUF-")) + (eof (gensym "EOF-"))) `(let ((,buffer (make-fields-buffer))) (with-open-file - (,ustream (umls-pathname ,filename) - :direction :input :if-exists :overwrite) - (do ((,line (read-buffered-fields ,buffer ,ustream) (read-buffered-fields ,buffer ,ustream))) - ((eq ,line 'kl::eof) t) + (,ustream (umls-pathname ,filename) :direction :input) + (do ((,line (read-buffered-fields ,buffer ,ustream #\| ,eof) + (read-buffered-fields ,buffer ,ustream #\| ,eof))) + ((eq ,line ,eof) t) ,@body))))) (defmacro with-buffered2-umls-file ((line filename) &body body) -"Opens a UMLS and processes each parsed line with (body) argument" - (let ((ustream (gensym)) - (buffer (gensym))) + "Opens a UMLS and processes each parsed line with (body) argument" + (let ((ustream (gensym "STRM-")) + (buffer (gensym "BUF-")) + (eof (gensym "EOF-"))) `(let ((,buffer (make-fields-buffer2))) (with-open-file (,ustream (umls-pathname ,filename) - :direction :input :if-exists :overwrite) - (do ((,line (read-buffered-fields2 ,buffer ,ustream) (read-buffered-fields2 ,buffer ,ustream))) - ((eq ,line 'eof) t) + :direction :input :if-exists :overwrite) + (do ((,line (read-buffered-fields ,buffer ,ustream #\| ,eof) + (read-buffered-fields ,buffer ,ustream #\| ,eof))) + ((eq ,line ,eof) t) ,@body))))) -