;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; Name: parse-macros.lisp
-;;;; Purpose: Macros for UMLS file parsing
-;;;; Programmer: Kevin M. Rosenberg
-;;;; Date Started: Apr 2000
+;;;; Name: parse-macros.lisp
+;;;; Purpose: Macros for UMLS file parsing
+;;;; Author: Kevin M. Rosenberg
+;;;; Date Started: Apr 2000
;;;;
-;;;; $Id: parse-macros.lisp,v 1.4 2003/05/06 01:34:57 kevin Exp $
+;;;; $Id: parse-macros.lisp,v 1.7 2003/05/07 21:57:06 kevin Exp $
;;;;
;;;; This file, part of UMLisp, is
;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
(in-package #:umlisp)
+(eval-when (:compile-toplevel)
+ (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))))
(defmacro with-umls-file ((line filename) &body body)
"Opens a UMLS and processes each parsed line with (body) argument"
(let ((ustream (gensym "STRM-"))
(eof (gensym "EOF-")))
- `(with-open-file
- (,ustream (umls-pathname ,filename) :direction :input)
- (do ((,line (read-umls-line ,ustream ,eof)
- (read-umls-line ,ustream ,eof)))
- ((eq ,line 'eof) t)
- ,@body))))
+ `(let ((,eof (gensym "EOFSYM-")))
+ (with-open-file
+ (,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 "STRM-"))
(buffer (gensym "BUF-"))
(eof (gensym "EOF-")))
- `(let ((,buffer (make-fields-buffer)))
- (with-open-file
- (,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)))))
+ `(let ((,buffer (make-fields-buffer))
+ (,eof (gensym "EOFSYM-")))
+ (with-open-file
+ (,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 "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-fields ,buffer ,ustream #\| ,eof)
- (read-buffered-fields ,buffer ,ustream #\| ,eof)))
- ((eq ,line ,eof) t)
- ,@body)))))
+ `(let ((,buffer (make-fields-buffer2))
+ (,eof (gensym "EOFSYM-")))
+ (with-open-file
+ (,ustream (umls-pathname ,filename)
+ :direction :input :if-exists :overwrite)
+ (do ((,line (read-buffered-fields ,buffer ,ustream #\| ,eof)
+ (read-buffered-fields ,buffer ,ustream #\| ,eof)))
+ ((eq ,line ,eof) t)
+ ,@body)))))