r4826: *** empty log message ***
[umlisp.git] / parse-common.lisp
index 8ba30e61bf9be0c4c52c68774fac2ed169372a92..1e40444eac2bd7ea1485eea896fc1bf4f81c2f12 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: parse-common.lisp,v 1.4 2002/10/21 02:23:46 kevin Exp $
+;;;; $Id: parse-common.lisp,v 1.6 2003/05/06 01:34:57 kevin Exp $
 ;;;;
 ;;;; This file, part of UMLisp, is
 ;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
 ;;;; 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)
+
+(eval-when (:compile-toplevel)
+  (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))))
 
 (defun umls-pathname (filename &optional (extension ""))
 "Return pathname for a umls filename"
     (pathname
       filename)))
 
-(defun read-umls-line (strm)
+(defun read-umls-line (strm &optional (eof 'eof))
   "Read a line from a UMLS stream, split into fields"
-  (let ((line (read-line strm nil 'eof)))
-    (if (stringp line) ;; ensure not 'eof
-       (let* ((len (length line))
-             (maybe-remove-terminal ;; LRWD doesn't have '|' at end of line
-              (if (char= #\| (char line (1- len)))
-                  (subseq line 0 (1- len))
-                line)))
-         (declare (fixnum len))
-         (delimited-string-to-list maybe-remove-terminal #\|))
-      line)))
-
+  (let ((line (read-line strm nil eof)))
+    (if (eq line eof)
+       eof
+       (delimited-string-to-list line #\| t))))
 
 ;;; Find field lengths for LEX and NET files