When scanning the object files for tags, use binary mode.

This commit is contained in:
Juan Jose Garcia Ripoll 2008-10-25 01:17:30 +02:00
parent c57459a6ad
commit 75464d29dd

View file

@ -65,9 +65,9 @@ machine."
(key (concatenate 'list tag ":"))
(string key))
(nil)
(let ((c (read-char stream nil nil)))
(let ((c (read-byte stream nil nil)))
(cond ((null c) (return nil))
((not (equal c (pop string)))
((not (= c (char-code (pop string))))
(setf string key))
((null string)
(return t))))))
@ -76,9 +76,9 @@ machine."
(declare (si::c-local))
(concatenate 'string
(loop with c = t
until (or (null (setf c (read-char stream nil nil)))
(equal c #\@))
collect c)))
until (or (null (setf c (read-byte stream nil nil)))
(= c #.(char-code #\@)))
collect (code-char c))))
(defun find-init-name (file &key (tag "@EcLtAg"))
"Search for the initialization function in an object file. Since the
@ -86,11 +86,12 @@ initialization function in object files have more or less unpredictable
names, we store them in a string in the object file. This string is recognized
by the TAG it has at the beginning This function searches that tag and retrieves
the function name it precedes."
(with-open-file (stream file :direction :input)
(with-open-file (stream file :direction :input :element-type '(unsigned-byte 8))
(cmpnote "Scanning ~S" file)
(when (search-tag stream tag)
(let ((name (read-name stream)))
(cmpnote "Found tag: ~S" name)
(cmpnote "Found tag: ~S for ~A" name file)
(print name)
name))))
(defun remove-prefix (prefix name)