- (loop
- (let ((line (read-line file nil nil)))
- (unless line
- (return))
- ;; UNIX symbol tables might have tabs in them, and tabs are
- ;; not in Common Lisp STANDARD-CHAR, so there seems to be no
- ;; nice portable way to deal with them within Lisp, alas.
- ;; Fortunately, it's easy to use UNIX command line tools like
- ;; sed to remove the problem, so it's not too painful for us
- ;; to push responsibility for converting tabs to spaces out to
- ;; the caller.
- ;;
- ;; Other non-STANDARD-CHARs are problematic for the same reason.
- ;; Make sure that there aren't any..
- (let ((ch (find-if (lambda (char)
- (not (typep char 'standard-char)))
- line)))
- (when ch
- (error "non-STANDARD-CHAR ~S found in foreign symbol table:~%~S"
- ch
- line)))
- (setf line (string-trim '(#\space) line))
- (let ((p1 (position #\space line :from-end nil))
- (p2 (position #\space line :from-end t)))
- (if (not (and p1 p2 (< p1 p2)))
- ;; KLUDGE: It's too messy to try to understand all
- ;; possible output from nm, so we just punt the lines we
- ;; don't recognize. We realize that there's some chance
- ;; that might get us in trouble someday, so we warn
- ;; about it.
- (warn "ignoring unrecognized line ~S in ~A" line filename)
- (multiple-value-bind (value name)
- (if (string= "0x" line :end2 2)
- (values (parse-integer line :start 2 :end p1 :radix 16)
- (subseq line (1+ p2)))
- (values (parse-integer line :end p1 :radix 16)
- (subseq line (1+ p2))))
- (multiple-value-bind (old-value found)
- (gethash name *cold-foreign-symbol-table*)
- (when (and found
- (not (= old-value value)))
- (warn "redefining ~S from #X~X to #X~X"
- name old-value value)))
- (setf (gethash name *cold-foreign-symbol-table*) value))))))
- (values)))
+ (loop for line = (read-line file nil nil)
+ while line do
+ ;; UNIX symbol tables might have tabs in them, and tabs are
+ ;; not in Common Lisp STANDARD-CHAR, so there seems to be no
+ ;; nice portable way to deal with them within Lisp, alas.
+ ;; Fortunately, it's easy to use UNIX command line tools like
+ ;; sed to remove the problem, so it's not too painful for us
+ ;; to push responsibility for converting tabs to spaces out to
+ ;; the caller.
+ ;;
+ ;; Other non-STANDARD-CHARs are problematic for the same reason.
+ ;; Make sure that there aren't any..
+ (let ((ch (find-if (lambda (char)
+ (not (typep char 'standard-char)))
+ line)))
+ (when ch
+ (error "non-STANDARD-CHAR ~S found in foreign symbol table:~%~S"
+ ch
+ line)))
+ (setf line (string-trim '(#\space) line))
+ (let ((p1 (position #\space line :from-end nil))
+ (p2 (position #\space line :from-end t)))
+ (if (not (and p1 p2 (< p1 p2)))
+ ;; KLUDGE: It's too messy to try to understand all
+ ;; possible output from nm, so we just punt the lines we
+ ;; don't recognize. We realize that there's some chance
+ ;; that might get us in trouble someday, so we warn
+ ;; about it.
+ (warn "ignoring unrecognized line ~S in ~A" line filename)
+ (multiple-value-bind (value name)
+ (if (string= "0x" line :end2 2)
+ (values (parse-integer line :start 2 :end p1 :radix 16)
+ (subseq line (1+ p2)))
+ (values (parse-integer line :end p1 :radix 16)
+ (subseq line (1+ p2))))
+ (multiple-value-bind (old-value found)
+ (gethash name *cold-foreign-symbol-table*)
+ (when (and found
+ (not (= old-value value)))
+ (warn "redefining ~S from #X~X to #X~X"
+ name old-value value)))
+ (/show "adding to *cold-foreign-symbol-table*:" name value)
+ (setf (gethash name *cold-foreign-symbol-table*) value))))))
+ (values)) ;; PROGN