Changeset 10018


Ignore:
Timestamp:
Jul 13, 2008, 2:30:22 AM (11 years ago)
Author:
gz
Message:

make source-text-from-%lfun-info (which is only used by the disassembler) try to fetch source text from the source file if it's not available from %lfun-info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-reader.lisp

    r10017 r10018  
    30143014  ;; transform), source-note of parent form
    30153015  source
     3016  ;; TODO: I don't think anybody uses this!
    30163017  ;; PC information generated by compiler.  For source notes not stored in
    30173018  ;; an lfun, it could contain intermediate results during compilation.
     
    30383039          (when file-name (list :file-name (source-note-file-name note)))))
    30393040
     3041;; For use by disassemble only
    30403042(defun source-text-from-%lfun-info (lfun-info)
    3041   (let ((note-plist (getf lfun-info 'function-source-note)))
    3042     (%fast-uncompact (getf note-plist :%text))))
     3043  (let ((note-info (getf lfun-info 'function-source-note)))
     3044    (when note-info
     3045      (or (%fast-uncompact (getf note-info :%text))
     3046          (fetch-source-text-from-file :file-name (getf note-info :file-name)
     3047                                       :start (getf note-info :start)
     3048                                       :end (getf note-info :end))))))
    30433049
    30443050(defun register-code-note-parent (note parent)
     
    31443150                                            :end-pos (+ (or start-offset 0) (file-position stream)))))))))
    31453151
     3152(defun fetch-source-text-from-file (&key file-name start end)
     3153  ;; TODO: This confuses file-position and character offsets...
     3154  (let ((truename (probe-file file-name)))
     3155    (when truename
     3156      (with-open-file (stream truename)
     3157        (when (<= end (file-length stream))
     3158          (file-position stream start)
     3159          (let ((text (make-string (- end start))))
     3160            (read-sequence text stream)
     3161            text))))))
     3162
    31463163(defun make-source-note (&key form stream start-pos end-pos subform-notes)
    31473164  (let ((recording (assq stream *recording-source-streams*)))
Note: See TracChangeset for help on using the changeset viewer.